6 methods for clearing floating html, 6 methods for floating html

Source: Internet
Author: User

6 methods for clearing floating html, 6 methods for floating html

 

For details, click

 

Display: inline-block:

 

1. display block elements in one row
2. Enable embedded support for width and height
3. The line feed is parsed.
4. When not set, the width is opened by the content.
5. Block tags are supported in IE6 and 7.

Because the inline-block attribute is parsed (with gaps) When wrapping, the floating float: left/right method is used.

Usage of floating:

1. display block elements in one row
2. Enable embedded elements to support width and height
3. When the width is not set to a high value, the width is opened by the content.
4. line breaks are not parsed (floating can be used to clear gaps when using in-row elements)
5. when an element is added to the floating path, the object is moved away from the document stream and in the specified direction, until the parent-level boundary or another floating element is reached (the document flow shows the position of objects in the document when they are arranged)

  Floating Method:
1. Float the parent level
(In this case, when the parent-level margin: 0 auto; is not centered) 2. Add the display: inline-block; (same method 1, not centered) to the parent level. Only IE6 and 7 Center) 3. Add <div class = "clear"> </div> to the floating element.
4. Add <br clear = "all">
5. Add {zoom: 1;} to the floating element parent level ;}
: After {content: ""; display: block; clear: both ;}
6. Add overflow: auto to the floating element parent level;Source: http://www.jb51.net/article/43261.htm

 

For more html/css content, click

 

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.