Double-Margin Bug in IE6

I always forget about this bug and end up being puzzled as to why the spacing on my page is all wrong, so remember this! This bug happens when you have a floated element with a margin defined in the same direction of the float. For example:

#sidebar {
     float: left;
     width: 200px;
     margin-left: 10px;
}

IE6 will actually double margin-left to 20px, throwing your page out of whack if you have a tight layout. To fix, all you have to do is add this rule to the floated element:

display: inline;

And boom! Another IE6 bug is squashed.

9 Comments

  1. Posted June 17, 2008 at 10:25 am | Permalink

    Great post Kevin. I hate IE bugs.

  2. gknee
    Posted June 17, 2008 at 10:46 am | Permalink

    Thanks mager, I forgot about that too.

  3. Brice
    Posted June 23, 2008 at 3:07 am | Permalink

    Give you a break mate, forget ie6 :)

  4. Posted July 25, 2008 at 5:50 pm | Permalink

    Wouldn’t this cause problems with users that like to navigate using tabs?

  5. Posted July 26, 2008 at 11:49 am | Permalink

    Wait, I think this comment went on the wrong article.

  6. Nysuatro
    Posted August 2, 2008 at 1:25 am | Permalink

    There is said better not use the inline statement. There are some issues with that.
    It’s better to give margin in the other direction then the float. like :

    #sidebar {
    float: left;
    width: 200px;
    margin-right: 10px;
    }

    This solves the problem of the double margin.But you have to tweak you design because of the right margin. Not much extra work :)

  7. Posted August 25, 2008 at 3:49 am | Permalink

    Nysuatro, or you just add the display:inline in a separate ie.css file with conditional comments… you will probably need one anyway :)

  8. Nysuatro
    Posted August 26, 2008 at 3:23 pm | Permalink

    @Scarf : I have read somewhere it is best to not use the display:inline for this problem. Dont know the reason anymore. If i find it back i will post it here.

  9. mediassassin
    Posted October 10, 2008 at 6:30 am | Permalink

    You can also specify it as “_display:inline;” which will act exclusively for IE6 (IE7 has fixed the underscore *hack*). just using display:inline “open” can have adverse effects on IE7.

9 Trackbacks

  1. By Buy percocet online without office visit. on August 31, 2008 at 1:53 am

    Buy percocet online without office visit….

    Buy percocet online no prescription….

  2. By Buy percocet online. on August 31, 2008 at 12:22 pm

    Buy percocet online….

    Buy percocet online. Buy percocet online no prescription….

  3. By Buy vicodin online. on September 3, 2008 at 4:47 pm

    Buy vicodin….

    Buy vicodin without script….

  4. By Percocet verses lortabs. on September 4, 2008 at 1:27 pm

    Bioavailability of percocet….

    Canadian prescritions and percocet. Percocet 7.5. Effects of long term percocet use. Percocet….

  5. By Vicodin. on September 5, 2008 at 12:35 pm

    What is vicodin….

    Vicodin hp. Vicodin. Vicodin at overseas pharmacies. Vicodin detox. Vicodin without prescription. Buy vicodin. Vicodin withdrawal symtoms….

  6. By Buy vicodin online. on September 10, 2008 at 3:47 am

    Forum vicodin buy vicodin online….

    Buy vicodin online next day delivery. Buy vicodin online. Buy vicodin online without a prescription. Buy vicodin online without prescription. Buy vicodin online without….

  7. By Percocet. on September 11, 2008 at 5:59 am

    How to extract acetaminophen from percocet….

    Percocet. Percocet shipped cod no prior. Therapeutic range for percocet….

  8. By Cheap percocet. on September 12, 2008 at 3:30 pm

    Cheap percocet….

    Percocet without prescription cheap. Cheap percocet….

  9. By meopgumz on October 8, 2008 at 9:18 am

    meopgumz…

    meopgumz…

Post a Comment

Your email is never published nor shared. Required fields are marked *

*
*
vpn service