|
1 <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd"> |
|
2 <html xmlns="http://www.w3.org/1999/xhtml"> |
|
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 <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." /> |
|
8 <style type="text/css"><![CDATA[ |
|
9 .container { |
|
10 width: 300px; |
|
11 border: 2px solid black; |
|
12 position: absolute; |
|
13 left: 25px; |
|
14 top: 25px; |
|
15 background-color: red; |
|
16 } |
|
17 |
|
18 .box-sized { |
|
19 box-sizing: border-box; |
|
20 width: 50%; |
|
21 z-index: 1; |
|
22 float: left; |
|
23 border: 5px solid black; |
|
24 padding: 0px 10px; |
|
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> |