Mobile End elasticity Effect

Source: Internet
Author: User

Layout One: Define the overall height of the page as 100%, then use the Position:absolute layout to resolve

<body>

<div class= "Wrap" >

<div class= "Header" >header</div>

<div class= "Main" >

Elastic scrolling Area

</div>

<div class= "Footer" >footer</div>

</div>

</body>

html,body{height:100%;}

. wrap{width:100%;}

. Header,.footer{height:40px;line-height:40px;background-color: #D8D8D8; text-align:center;}

. header{position:absolute;top:0;left:0;width:100%;}

. footer{position:absolute;bottom:0;left:0;width:100%;}

. main{

Position:absolute;

Z-index:1;

top:40px;

left:0;

bottom:40px;

width:100%;

}

Layout Two: Define the overall height of the page as 100%, then use the Display:flex layout to solve

<body>
<div class= "Wrap" >
<div class= "Header" >header</div>
<div class= "Main" >
Elastic scrolling Area
</div>
<div class= "Footer" >footer</div>
</div>
</body>
html,body{height:100%;}
. wrap{display:-webkit-box;display:-webkit-flex;display:-ms-flexbox;display:flex;-webkit-box-orient:vertical;- webkit-flex-direction:column;-ms-flex-direction:column;flex-direction:column;width:100%;height:100%;}
. Header,.footer{height:40px;line-height:40px;background-color: #D8D8D8; text-align:center;}
. main{-webkit-box-flex:1;-webkit-flex:1;-ms-flex:1;flex:1;width:100%;}

Then the main problem is that the child container height exceeds the height of the parent container and how the content of the child container scrolls.

. css{
overflow:auto;/* Winphone8 and android4+ * *
-webkit-overflow-scrolling:touch; /* ios5+ */
}

Mobile End elasticity Effect

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.