The effect of fixing the top and bottom is very easy, and many people will choose this way, that is, the top position:fixed, the bottom is also position:fixed. The effect is like the following two images, the container area is covered with the entire screen, and the scroll bar is also scrolled throughout the screen, adjust the content area only height adjustment.
In fact, there is a way to achieve better results, that is, the content area only in the middle of the top and bottom, the content and scroll bar is only the middle area scrolling
Implementation code:
<meta name= "viewport" content= "width=device-width,initial-scale=1.0, maximum-scale=1.0, user-scalable=0" > Added to the page.
<div class= "Top" > <p> top </p> </div> <div class= "Container-wrap" > <d IV class= "Container" > <p> mobile Device The default viewport is layout viewport, which is more than the width of the screen viewport, but in the development of mobile device website, we need the IDE Al Viewport. So how do you get ideal viewport? It's time for the meta tag to appear. The default viewport for mobile devices is the layout viewport, which is the viewport that is wider than the screen, but when it comes to the development of mobile device sites, we need ideal viewport. So how do you get ideal viewport? It's time for the meta tag to appear. The default viewport for mobile devices is the layout viewport, which is the viewport that is wider than the screen, but when it comes to the development of mobile device sites, we need ideal viewport. So how do you get ideal viewport? It's time for the meta tag to appear. The default viewport for mobile devices is the layout viewport, which is the viewport that is wider than the screen, but when it comes to the development of mobile device sites, we need ideal viewport. So how do you get ideal viewport? It's time for the meta tag to appear. The default viewport for mobile devices is the layout viewport, which is the viewport that is wider than the screen, but when it comes to the development of mobile device sites, we need ideal viewport. So how do you get ideal viewport? It's time for the meta tag to appear. The default viewport for mobile devices is the layout viewport, which is the viewport that is wider than the screen, but when it comes to the development of mobile device sites, we need ideal viewport. So how do you get ideal viewport? It's time for the meta tag to appear. The default viewport for mobile devices is the layout viewport, which is the viewport that is wider than the screen, but in the development of mobile device sites, we need toWant is ideal viewport. So how do you get ideal viewport? It's time for the meta tag to appear. The default viewport for mobile devices is the layout viewport, which is the viewport that is wider than the screen, but when it comes to the development of mobile device sites, we need ideal viewport. So how do you get ideal viewport? It's time for the meta tag to appear. </p> </div> </div> <div class= "Footer" > <ul> <li> Home < ;/li> <li> Malls </li> <li> me </li> </ul> </div>
Css:
<style> *{padding:0;margin:0;font-family: ' Microsoft Yahei ';} . Top{width:100%;height:60px;background-color: #999;position:fixed;top:0;}. Top P{color: #333; line-height:60px;text-align:center;font-size:22px;} . container-wrap{Height:100%;overflow:hidden;}. container{position:absolute;top:60px;bottom:60px; overflow-y: scroll;Overflow-x: Hidden;} . container p{font-size:20px;line-height:32px;padding:10px 15px;} . footer{width:100%;height:60px;border-top:1px solid #999;position:fixed;bottom:0;Background-color: #fff;} . footer Ul{list-style:none;} . Footer ul Li{float:left;width:33.3%;text-align:center;line-height:60px;color: #333;} </style>
This implementation will enable the content to scroll only in Contianer. Very simple ~
Enables top and bottom pinning of mobile end, content area optimization effect