The Dopefly Tech Blog

« The Dopefly Tech Blog Main page

IE layout problems fixed

posted under category: Standards on October 4, 2006 by Nathan

If you saw this site in the last couple days with IE6, you saw the box model problem they always talk about. I liberally use padding in my stylesheets. Padding, of course, is the space between the border of an area and the content within that area. When you specify a width and a padding size, you are supposed to subtract the width of that padding (on each side), and your margins and borders to get the size of your area. However, IE6 doesn't really abide by this law.

It's a fairly simple fix, thankfully.

div#content {
padding:0 25px;
width:500px;
}
html>body div#content {
width:450px;
}

The more specific html>body rule overrides the cascading width for browsers who know how to obey rules.

Nathan is a software developer at The Boeing Company in Charleston, SC. He is essentially a big programming nerd. Really, you could say that makes him a nerd among nerds. Aside from making software for the web, he plays with tech toys and likes to think about programming's big picture while speaking at conferences and generally impressing people with massive nerdiness and straight-faced sarcastic humor. Nathan got his programming start writing batch files in DOS. It should go without saying, but these thought and opinions have nothing to do with Boeing in any way.
This blog is also available as an RSS 2.0 feed. Click your heels together and click here to contact Nathan.