Why doesn't CSS set min-height to body?

Source: Internet
Author: User
When the content area of the Web page is very small, footer will run to the top?
I set min-height:100% for body,html;
Set height:100%; it's okay, but it's a little more than a screen.

body,html{   min-height:100%;} body{   position:relative;}. content{  podding-bottom:100px;}. footer{position:absolute;bottom:0;left:0;height:100px;}

Write this:

HTML {    height:100%;} body {    position:relative;    min-height:100%;    Box-sizing:border-box;     padding-bottom:80px; /* Footer height, footer placeholder */}. footer {     position:absolute;     bottom:0;     left:0;     width:100%;     height:80px;}

The above code is compatible to IE8 and above

I've had problems like this, and that's how I solve them:

html,body,.content{    min-height:100%;} html{    -ms-text-size-adjust:100%;    -webkit-text-size-adjust:100%;} body{    background: #eeeeee;}

Then use the JS control to get $ (". Content"). Height ($ ("html"). height); I feel this adjustment is a bit more reliable.

100% is based on his father's elements to do the comparison, for example,

<div style= "width:100px;" >    <div style = "width:50%;" ></div></div>

Back to the landlord problem, so HTML can only set a fixed height, set the body height percentage, then you set the height of the HTML element!

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.