Some tips in Div + CSS are compatible with browsers

Source: Internet
Author: User

(1) For a layer with a floating layer, the main layer should use overflower: hidden to eliminate other external effects caused by the floating layer.

For example:

<Div id = "main1">
<Div id = "son1" style = "float: Left; display: inline"> AA </div>
</Div>
<Div id = "main2" style = "margin-top: 10px;">
Main2 content
</Div>

At this time, if mian1 does not include overflower: hidden, the margin-top of main2 has no effect because of the influence of the floating element son1.

Display: inline is used to ensure compatibility with the floating margin of IE6. Of course, there are other ways to eliminate the influence of float, that is, add a div behind the floating element to make it clear: Left, right, both

(2) For floating Li, to arrange multiple rows and multiple columns, Li should refer to the write height and width. The height is specified because if no height is specified, the Li in the first row will sink if the number of lines in the text is different.

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.