The Lodge is members-only design/dev videos and Office Hours.

Next Office Hours Session: "SVG" Oct 14 - 6:30 PM Eastern
Get a free trial // Grow your CSS skills // Land your dream job

How do you avoid defining width and padding in the same div?

  • # October 25, 2008 at 7:06 pm

    I’ve heard from various sources that when you define both width and padding in one declaration that IE6 doubles the padding. So how do you avoid defining width and padding in the same div?

    Obviously, you can split your definition between two divs.

    That’s what I’ve been doing but it looks silly and makes the code less readable. I use margin wherever I can but sometimes you just have to have padding.

    Is this what other people do or is there a better way?

    Maybe we can get someone to pass a law against using IE6?

    # October 25, 2008 at 7:34 pm

    I find, personally, that if I absolutely need both with and padding I use nested divs. No crime there other than a very slight blow to semantics (big deal). Often though, you can find a different way to go about it that doesn’t require both.

Viewing 2 posts - 1 through 2 (of 2 total)

You must be logged in to reply to this topic.

There's a whole bunch of content on CSS-Tricks.

Search for Stuff   •   Browse the Archives

Get the Newsletter ... or get the RSS feed