Height Adaptive for elements

Source: Internet
Author: User

Height Adaptive for elements

Web page layout Sometimes some height needs to adjust according to content, so can not be fixed, today, say, the minimum height adaptive

Property: Min-height minimum height, but IE6 does not recognize the property, height is similar to min-height attribute in IE6;

Here's how to fix the bug problem:

Hack1:min-height:value; _height:value; (IE6 can recognize the underscore "_" and the asterisk "*", IE7 can recognize the asterisk "*", but not the underscore "_", and Firefox two do not know)

Hack2:min-height:value; _height:auto!important; Height:value; (recommended)

Min-height min. height

Max-height Maximum Height

Min-width min. width

Max-width Maximum width

Height adaptation of floating elements

If the parent element does not have a height and width, and it contains a floating element, then its height will be collapsed, the problem of resolving the height collapse is simple, can float the parent element, the purge method and so on, can achieve

Hack1: Adds a floating property to the parent element: float;

Hack2: Add attribute to parent element: Overflow:hidden;

Hack3: Add an empty div below the floating element and add properties to this element: Clear:both;height:0;overflow:hidden;

HACK3: Add this claim to the parent element (recommended)

Parent element: after{content: "."; height:0; Display:block; Overflow:hidden; Clear:both; Visibility:hidden;}

  • 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.