The magical application of minimum height (min-height) in CSS layout

Source: Internet
Author: User
Tags min reference
Css

The minimum height can be set a box of the minimum height, when its content less time, can also keep box height is certain, beyond the automatic downward extension, but so far, only opera and Mozilla support, IE7 began to support, but IE7 in the test phase, Such official version of the release to the popularization of a period of time may be longer, unless the MS bundled it on an operating system, how on the existing basis (IE6 80-90%), reasonable, the minimum height of the magical?

Assuming there are two box, we need it with a minimum height of 150PX.

Css

The following is a reference fragment:






}

Xhtml

The following is a reference fragment:


When the content is less, it can keep box height for certain </div>

Now the effect, ie did not maintain a minimum height of 150px.

Way to solve

Set a height for IE

The following is a reference fragment:
* HTML div.box1,* HTML div.box2{height:150px;}

The wellstyled.com solution is to use the CSS property selector (attribute selectors)

The following is a reference fragment:



/* Div object with class selector (Class) attribute/*

IE is not supported by nature, Opera and Mozilla support, read this height. Applicable occasions: Search, articles and other pages (not using 100% height, when the content of the search is less, not too short page.)



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.