box-sizing-border-box-004

Box Sizing - Border-Box with min/max width/height

WeasyPrint

Reference (good) by WeasyPrint

Reference (good) by this browser

This browser

Assertion
box-sizing: border-box should make the element's (length) 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 min/max 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-004-ref.htm">
 8   <meta name="assert" content="box-sizing: border-box should make the element's (length) 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       min-width: 500px;
12       max-width: 700px;
13       min-height: 70px;
14       max-height: 90px;
15       border: 2px solid black;
16       position: absolute;
17       left: 25px;
18       top: 25px;
19       background-color: red;
20     }
21 
22     .box-sized {
23       box-sizing: border-box;
24       min-width: 250px;
25       max-width: 350px;
26       min-height: 70px;
27       max-height: 90px;
28       z-index: 1;
29       float: left;
30       border: 5px solid black;
31     }
32 
33     #one {
34       background-color: green;
35     }
36 
37     #two {
38       background-color: blue;
39     }
40   </style>
41  </head>
42  <body>
43    The two divs should be side-by-side, not one on top of another. No red should be visible.
44    <br>
45    <div class="container">
46      <div class="box-sized" id="one">LEFT HALF</div>
47      <div class="box-sized" id="two">RIGHT HALF</div>
48    </div>
49  </body>
50 </html>