box-sizing-border-box-003

Box Sizing - Border-Box with specified width/height

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 and the height be the distance from the top border edge to the bottom 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/height</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-003-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 and the height be the distance from the top border edge to the bottom border edge.">
 9   <style type="text/css">
10     .container {
11       width: 300px;
12       height: 400px;
13       border: 2px solid black;
14       position: absolute;
15       left: 25px;
16       top: 25px;
17       background-color: red;
18     }
19 
20     .box-sized {
21       box-sizing: border-box;
22       width: 50%;
23       height: 100%;
24       z-index: 1;
25       float: left;
26       border: 5px solid black;
27       padding: 25px 10px;
28     }
29 
30     #one {
31       background-color: green;
32     }
33 
34     #two {
35       background-color: blue;
36     }
37   </style>
38  </head>
39  <body>
40    The two divs should be side-by-side, not one on top of another. No red should be visible.
41    <br>
42    <div class="container">
43      <div class="box-sized" id="one">LEFT HALF</div>
44      <div class="box-sized" id="two">RIGHT HALF</div>
45    </div>
46  </body>
47 </html>