Float and cssfloat of CSS

Source: Internet
Author: User

Float and cssfloat of CSS

Reference: Share: float floating in CSS

I. Initial Design of float

To achieve the effect of text wrapping

Package: BFC (Block-level formatting context)

Destruction: the container is damaged, and the parent element height collapsed (standard,

Ii. Clear floating (IMPACT)

1: method 1, insert clear: both at the bottom

Clear: Bottom of html block horizontal element

Css after pseudo element

 

2: Method 2: BFC/haylayout

3: clear overlaps with margin.

3. Floating and Fluid layout

Minimize the use of flaot for Brick layout, floating for Fluid layout

4. float compatibility
What is the role of css float?

If no floating is defined, the content of each div is arranged from top to bottom on the page.
If a div defines float: left, the div will appear at the leftmost position under the upper-layer div, which is of the same level as the div, however, the div column after it will be displayed on its right.
Similarly, if float: right is defined, this div will appear at the rightmost position under the upper div, which is of the same level as it, however, the div column before it is displayed on its left.

Two-or multi-column page layout will be used.

Float floating whereabouts in CSS

Add a parent DIV to the three Divs,
Define the width of the parent DIV as the sum of the total width of the three Divs,
No matter how it changes, it will not fall.
<Div>
<Div> </div>
</Div>

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.