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.

*May or may not contain any actual "CSS" or "Tricks".