Use Br Instead of Div to clear float

Source: Internet
Author: User

When I started to set up my own blog, I tested it in IE, Firefox, chrome, and 360 browsers, and there was no problem with front-end performance. A few days ago, a foreign friend sent a message to my blog saying that my blog was a problem when he browsed it. He used opera. I immediately ran a opera test. In opera, the margin under the navigation bar becomes very small.

The following is a comparison between IE and opera:

Involved performanceSource codeAs follows:

<Div id = "lt_title"> <span Title = "article title">  
 
# Lt_navigation_top {margin: 0 0 43px 0; border-top: dotted 1px # CCC; color: # CCC; font-family: century Gothic, Arial, Helvetica, Georgia, sans-serif ;}

After testing, it is found that DIV has a default height when floating is cleared, and it is abnormal in opera.

Change the DIV to the following method and try again.

 
<Div style = "clear: Both; Height: 0"> </div>

The effect is basically as expected, but there is still a small difference. In the end, simply replace Div with Br to clear the floating

 
<Br style = "clear: Both; Height: 0; font-size: 0px;">

Solve the problem.

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.