The use of Min-height in Div CSS webpage Layout

Source: Internet
Author: User

Assuming there are two boxes, we need the minimum height of the box to be 150px.
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
* 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, ArticleAnd other pages (no 100% height is used. When there is little content found, the page will not be too short.
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.