box-sizing-border-box-001

Box Sizing - Border-Box with specified width

WeasyPrint

Reference (good) by WeasyPrint

Reference (good) by this browser

This browser

Assertion
box-sizing: border-box should make the element's (percentage) width be the distance from the left border edge to the right border edge.

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: Box Sizing - Border-Box with specified width</title>
 5   <link rel="author" title="Scott Johnson" href="mailto:sjohnson@mozilla.com">
 6   <link rel="help" href="http://www.w3.org/TR/css3-ui/#box-sizing">
 7   <link rel="match" href="reference/box-sizing-border-box-001-ref.htm">
 8   <meta name="assert" content="box-sizing: border-box should make the element's (percentage) width be the distance from the left border edge to the right border edge.">
 9   <style type="text/css">
10     .container {
11       width: 300px;
12       border: 2px solid black;
13       position: absolute;
14       left: 25px;
15       top: 25px;
16       background-color: red;
17     }
18 
19     .box-sized {
20       box-sizing: border-box;
21       width: 50%;
22       z-index: 1;
23       float: left;
24       border: 5px solid black;
25     }
26 
27     #one {
28       background-color: green;
29     }
30 
31     #two {
32       background-color: blue;
33     }
34   </style>
35  </head>
36  <body>
37    The two divs should be side-by-side, not one on top of another. No red should be visible.
38    <br>
39    <div class="container">
40      <div class="box-sized" id="one">LEFT HALF</div>
41      <div class="box-sized" id="two">RIGHT HALF</div>
42    </div>
43  </body>
44 </html>