Let 'Em Do What They Do

Album Cover: Vitalogy

"Wait for signs, believe in lies, to get by, it's divine."
Pearl Jam / Tremor Christ

Posted on September 21, 2006 1:28 AM in Web Design
Warning: This blog entry was written two or more years ago. Therefore, it may contain broken links, out-dated or misleading content, or information that is just plain wrong. Please read on with caution.

As usual, Jonathan Snook has provided a great tip for dealing with block elements in his post, Top CSS Tips:

My rule of thumb is, if I set a width, I don't set margin or padding. Likewise, if I'm setting a margin or padding, I don't set a width. Dealing with the box model can be such a pain, especially if you're dealing with percentages. Therefore, I set the width on the containers and then set margin and padding on the elements within them. Everything usually turns out swimmingly.

Based on my own experience with the box model (which has been well documented), this is very sound advice.


Ryan on September 22, 2006 at 1:25 AM:

My method to deal with the madness is similar -- I throw in an extra div -- one for widths, and one for padding. Its annoying, but not that bad really.


Bernie Zimmermann on September 23, 2006 at 6:53 PM:



Ryan on September 23, 2006 at 8:56 PM:

It worked.


Chris Kosciuk on October 03, 2006 at 3:38 AM:

I think you have a good rule to stick with when dealing with containers.
Thanks for informative articles.

Chris Kosciuk


Post Comments

If you feel like commenting on the above item, use the form below. Your email address will be used for personal contact reasons only, and will not be shown on this website.


Email Address:



Check this box if you hate spam.