Summary of css comprehensive floating cleaning

Source: Internet
Author: User
Tags advantage

1. Use a pseudo-class: after to clear the pseudo-class layer with zero height in the subsequent blank system

2. Use css overflow: auto to raise the bar

3. Use css overflow: Den to generate weird adaptation

4. Use display: table to convert objects into tables.

5. Use the div tag and the clear attribute of css.

6. Use the br label and the clear attribute of css.

7. Use the br tag and the clear attribute of its own html

8. In a rough view, they can solve the problem. However, they have their own advantages and disadvantages on the other hand. (One-to-one correspondence)

 

1.

The advantage structure is completely semantically correct and will not cause any other weird problems.

 

Disadvantages: improper reuse may cause a sharp increase in the amount of code.

 

It is recommended that the outermost layer be used for light floating or clear modular reuse.

2.

 

Advantage structure semantics is completely correct, and the amount of code is very small.

 

Disadvantages after multiple nesting, clicking the light floating box on the outermost layer will be selected as the outermost layer to the innermost layer (ff ); or when the width of the mouseo tutorial ver changes, the outermost layer module has a scroll bar (ie ).

 

We recommend that you use the internal modules. Do not nest them.

3.

 

Advantage structure semantics is completely correct, and the amount of code is very small.

 

When the content is increased, it is easy to avoid line breaks and the content is hidden.

 

We recommend that you use it when the width is fixed. Do not nest it.

4.

 

Advantage structure semantics is completely correct, and the amount of code is very small.

 

The downsides of the box model have changed. As you can imagine, there are naturally more singular events than you can count.

 

It is recommended that you do not use it if you do not want to change the bug to death. However, it can be used as a temporary test in alpha version.

5.

 

The advantage code is very small, and the reusability is extremely high.

 

Disadvantages are completely unable to perfectly adapt to semantics, which is not conducive to revision and demand changes.

 

It is recommended for beginners to solve floating problems quickly.

6.

 

Advantages: the semantic level is better than that in 5th cases; the amount of code is very small, and the reusability is extremely high.

 

Disadvantages: the semantics is still not perfect, which is not conducive to revision and demand change.

 

It is recommended for beginners to solve floating problems quickly.

7.

 

Advantages: the semantic level is better than that in 5th and 6 cases; the code volume is the least, and the reusability is extremely high.

 

Disadvantages: the semantics is still not perfect, which is not conducive to revision and demand change.

 

It is recommended to guide beginners to think about how to use the classname to control the performance. It is better to use html attributes to control the performance of webpages that return to the era of web1.0, after all, the latter has less code.

 

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.