April 15, 2008 - Rajesh Odayanchal



Here is a sample div with class “boxtest”.

It has 20px border, 30px padding, and 300px width.

div.boxtest {
border:20px solid;
background: #ffc;

The total width including borders and padding should be 400px.

20+30+300+30+20 = 400

User agents which misinterpret the CSS1 box model by placing border and padding inside the specified width would result in a total width of only 300px, and a content width of only 200px.

300-20-30-30-20 = 200

The red and blue bars below are there for comparison. This div (including its borders) should be as wide as the blue bar.

css / css tags / help css / css2 / css3 / help / tutorial /

Leave a Reply

Your email address will not be published. Required fields are marked *