block-non-replaced-width-001

Solving for width of block-level non-replaced elements in normal flow

WeasyPrint

This browser

Assertion
The equation; 'margin-left' + 'border-left-width' + 'padding-left' + 'width' + 'padding-right' + 'border-right-width' + 'margin-right' is equal the width of containing block.

Source

 1 <!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
 2 <html>
 3     <head>
 4         <title>CSS Test: Solving for width of block-level non-replaced elements in normal flow</title>
 5         <link rel="author" title="Microsoft" href="http://www.microsoft.com/">
 6         <link rel="help" href="http://www.w3.org/TR/CSS21/visudet.html#blockwidth">
 7         <meta name="flags" content="">
 8         <meta name="assert" content="The equation; 'margin-left' + 'border-left-width' + 'padding-left' + 'width' + 'padding-right' + 'border-right-width' + 'margin-right' is equal the width of containing block.">
 9         <style type="text/css">
10             #div1
11             {
12                 background-color: orange;
13                 border: 5px solid orange;
14                 display: inline-block;
15             }
16             div div
17             {
18                 background-color: orange;
19                 border-left: 10px solid orange;
20                 border-right: 10px solid orange;
21                 height: 20px;
22                 margin-left: 10px;
23                 margin-right: 10px;
24                 padding-left: 10px;
25                 padding-right: 10px;
26                 width: 80px;
27             }
28             #d3
29             {
30                 background-color: blue;
31                 height: 30px;
32                 position: absolute;
33                 top: 82px;
34                 width: 150px;
35             }
36         </style>
37     </head>
38     <body>
39         <p>Test passes if the orange and blue boxes below are the same width.</p>
40         <div id="div1">
41             <div></div>
42         </div>
43         <div id="d3"></div>
44     </body>
45 </html>