IE6 repeat text Bug Resolution summary

Source: Internet
Author: User

On the internet first found a few of the same article, explained the reason is the bug caused by the annotation, but my code does not have a comment ah, summed up a bit about the solution

1, do not place comments. This is the simplest and quickest solution, but inconvenient, sometimes need to annotate;
2, note do not place in the 2 floating blocks between;
3, the text block is included between the new elements (this added extra elements), such as the outside to add a layer of div;
4, remove the fixed width of the text block, and 3 have similarities;
5, in the back add a
Or a space (this adds an extra element);
6, the use of IE annotation format (this is available, whether in IE or Firefox are normal display, but also in line with the standard, but not the same as regular notes)
7, add to the box; attributes (personally think this should be the best solution, should only IE6 have this bug, you can only IE6 add this attribute).

Cases

The code is as follows Copy Code

<meta http-equiv= "Content-type" content= "text/html charset=gb2312"
<style "type=" >
  #test {
  border:1px solid #ddd;
  width:300px
 }
  #test a {   float:left;
  width:50%;
 }
  #test a:hover {
  background-color: #ddd;      
 }
</style>
<body>
<div id= "test"
    <a href= "#" > 12345 </a>
    <a href= "#" > Uphill fight Tiger </a>
    <a href= "#" > Tiger not home </a>
    <a href= "#" > See little Squirrel </a>
    <a href= "#" > number to </a>
    <a href= "#" > How many more a squirrel </a>
</div>
</body>

The solution of the bug, first think of the famous IE6 floating element more out of 3pxbug
Therefore, the method of eliminating 3px bugs is adopted to margin-right:-3px the floating elements.
As a result, the bug disappears and the code follows

The code is as follows Copy Code

<meta http-equiv= "Content-type" content= "text/html; charset=gb2312"
<style type= " Text/css
  #test {
  border:1px solid #ddd;
  width:300px;
 }
& nbsp. #test a {
  float:left;
  width:50%;
  margin-right:-3px;
 }
  #test a:hover {
  background-color: #ddd;      
 }
</style>
<body>
<div id= "test"
    <a href= "#" > 12345 </a>
    <a href= "#" > Uphill fight Tiger </a>
    <a href= "#" > Tiger not home </a>
    <a href= "#" > See little Squirrel </a>
    <a href= "#" > number to </a>
    <a href= "#" > How many more a squirrel </a>
</div>
</body>

Workaround Two
The second way to clear bugs, floating elements plus background color background-color: #eee;, bug disappears

The code is as follows Copy Code
<meta http-equiv= "Content-type" content= "text/html; charset=gb2312 ">
<style type= "Text/css" >
#test {
border:1px solid #ddd;
width:300px;
}
#test a {
Float:left;
width:50%;
Background-color: #eee;
}
#test A:hover {
Background-color: #ddd;
}
</style>
<body>
<div id= "Test" >
<a href= "#" > 12345 </a>
<a href= "#" > Mountain play Tiger </a>
<a href= "#" > Tigers not Home </a>
<a href= "#" > See Little Squirrel </a>
<a href= "#" > Count to </a>
<a href= "#" > How many more a squirrel </a>
</div>
</body>

Three methods in the test demo can solve the problem, in the case I encountered only one method is feasible, so I ie6 repeat the text bug's conclusion is floating, floating is the key to cause this bug, as to why the floating can cause this phenomenon

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.