Solve the BUG of duplicate IE text display

Source: Internet
Author: User
There are only the first five (one more under IE6)


Condition:

The float attribute is used in CSS and html comments are used. <! --Note -->,

Note:This multi-text bug has been solved in IE7 and IE8, which is still in beta version.

 

The solution is as follows:
--------------------------------------------
Code:

<Div style = "width: 200px;">
<Div style = "float: left;"> </div> <! -- Count the number of prefixes in IE6 -->
<Div style = "float: left; width: 200px;"> front, front </div>
<Div style = "clear: both;"> </div>
</Div>

 Before, before, and before

Solution 1: Add "display: inline" to the parent container;

Code:
<Div style = "width: 200px; display: inline;">
       <Div style = "float: left;"> </div> <! -- Count the number of prefixes in IE6 -->
       <Div style = "float: left; width: 200px;"> front, front </div>
       <Div style = "clear: both;"> </div>
</Div>

  Before, before, and before

Solution 2: Remove comments from sub-containers

Code:
<Div style = "width: 200px;">
       <Div style = "float: left;"> </div>
       <Div style = "float: left; width: 200px;"> front, front </div>
       <Div style = "clear: both;"> </div>
</Div>

  Before, before, and before

Solutions for other websites

1. Remove "float: left;" in <div style = "float: left"> </div>. The page is displayed normally.
Remove "float: right;" in <div style = "float: right; width: 400px">, and the page is displayed normally. Solution: use a combination of display: block, display: inline-block, and display: inline to replace the float function.

2. Text overflow caused by comments is related to the position. The text overflow caused by the comment is related to the fixed width of the text block. Solution: Remove comments or fix the width. Replace the comments with the percentage width instead of the floating block.

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.