Css:min-height is not compatible with Firefox browser solutions

Source: Internet
Author: User
When we are in the page architecture, we usually divide into three section:header, body, and footer. As the following page:

At this point we need to set the body part to a minimum height to avoid the footer part appearing in the middle of the page. Let's say the following in this notation:

. page-content-header {    min-height:5%;}. page-content-body {    min-height:100%;}. page-content-footer {    min-height:5%;}

This kind of writing will let the body part has a full page size height, the footer part will naturally be at the lowest end of the page, and when the body part of the content exceeds 100%, the height will be automatically open, there will be no overflow situation.

However, the problem comes, Firefox is not compatible with this writing, min-height:100% completely does not take effect, we can use the following methods to be compatible:

. page-content-body {    min-height:100%;    /* Firefox compatible */    min-height:600px!important;}.  Page-content-body:after {   content: "";  Visibility:hidden;  Display:block;  Clear:both; height:0px;}

First we use!important to do hack to Firefox, set a minimum height of 600px, and then use pseudo-elements: After to do the style cleanup to achieve when the content exceeds the minimum height, the height will increase correspondingly.

We set the Display box type to block-level element block, set clear to not allow floating elements on both sides, we inserted the content of the build is empty, and then set the height to 0, the element is set to invisible.

This will allow Firefox to achieve the minimum height and content beyond the adaptive.

Related Article

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.