View Full Version : Div padding issue

02-21-2009, 04:45 PM
I'm having a little problem with my new site.

I have a Div element, which is explicitly set to 226px wide (inside the div is a load of text). To that i've applied a 10px padding all the way round, so the css is currently:

.layout_style_left_panel { width: 226px; float: left; padding: 10px; }

Now that looks just fine in IE, but firefox appears to add the 10px padding to each side of the div, making it in effect 246px wide, not 226!

Could one of you good people please tell me why and how to fix it please?

02-21-2009, 05:10 PM
My mistake chaps. I realise that FF is infact doing things correctly. I've specified a strict Doctype now and restyled accordingly.

Thank you.

02-21-2009, 06:55 PM
Hello fm010994,
Yes, padding counts. So does margin and border.
Have a look at the box model. (http://www.w3.org/TR/CSS2/box.html)