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.
Comments
Test.
It worked.
I think you have a good rule to stick with when dealing with containers.
Thanks for informative articles.
Chris Kosciuk
admin/CTKconnect
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.
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.
Permalink