Thursday, January 15, 2009

Boxtest

Boxtest

Here is a sample div with class "boxtest".

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

div.boxtest {
border:20px solid;
padding:30px;
background: #ffc;
width:300px;
}

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.

0 comments:

Post a Comment