CSS Clear Float

Source: Internet
Author: User
Why to clear floating

Floating floats is a layout in CSS where the render position is between the line box and the containing block, so that the text in the row box does not overlap with the floating element and is surrounded by it, and it is often used in the layout process to achieve the effect of the left and right side-by layout, but because of the floating characteristics, If the container does not explicitly set the height, it will be set according to the height of the elements in the normal flow, which will cause floating elements out of the normal flow to overflow the container, affecting the layout of the elements thereafter.

Clearing the floating clear property with the clear style does not allow floating elements to be cleared on the left/right side of the floating element, and the underlying principle is to add enough clear space above or below the element that is cleared to float.
Note that we do this by clearing the float on another element, rather than on a floating element.
code in HTML

Code in CSS


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.