Div css webpage layout: the use of min-height

Source: Internet
Author: User

The minimum height can be set to the minimum height of a BOX. When the content of a BOX is small, the height of the BOX can be kept to a certain level, and the BOX will be automatically extended down until now, only supported by Opera and Mozilla, and IE7 was also supported at the beginning, but IE7 is in the testing stage. It may take a long time to wait for the official version to become popular, unless MS binds it to an operating system, how can we reasonably and skillfully use it at least on the existing basis (IE6 80-90%?
Assuming there are two boxes, we need the minimum height of the BOX to be 150PX.

The code is as follows: Copy code
CSS
Div. box1, div. box2 {
Width: 300px;
Min-height: 150px;
Background: # EEE;
Float: left;
Margin-right: 20px;
       }
Xhtml
<Div> IE does not keep the minimum height of 150px </div>
<Div> The minimum height can be set to the minimum height of a BOX. When there are few contents, the height of the BOX can be kept to a certain level. </div>

In the current results, IE does not keep the minimum height of 150px.
Solution
Set a height for IE

The code is as follows: Copy code
* Html div. box1, * html div. box2 {height: 150px ;}
The solution of wellstyled.com is to use Attribute Selectors of CSS)
Div. box1, div. box2 {... height: 150px ;}
/* IE depends on this to keep the minimum height. If the height is exceeded, it will automatically extend down */
Div [class]. box1, div [class]. box2 {height: auto ;}
/* DIV objects with class attributes */

IE is naturally not supported. It is supported by Opera and Mozilla to read this height. Applicable scenarios: Search, articles, and other pages (no 100% height is used. When there are few searched content, the page will not be too short.

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.