CSS Clear Float

Source: Internet
Author: User

The height of the parent element is stretched by the child element, and the children are set to float, the parent element is not set to float, the child element is detached from the standard document flow, the height of the parent element is ignored, and if the float is not cleared, the parent element will appear highly insufficient. That way, if the settings border or background are not correctly parsed.

To clear floating methods:

1. Add Overflow:auto to the floating element parent, and add the zoom:1 to the IE6

2. Use: After pseudo element

. clearfix:after{
Content: "";
Dispaly:block;
height:0;
Clear:both;
Visibility:hidden;
}
. clearfix{
Zoom:1;
}
Or:
. clearfix:after,.clearfix:before{
Content: "";
display:table;
}
. clearfix:after{
Clear:both;
}

CSS Clear Float

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.