box-sizing-008

box-sizing:border-box and auto sizing of replaced elements with intrinisic width only.

WeasyPrint

Reference (good) by WeasyPrint

Reference (good) by this browser

This browser

Flags
svg
Assertion
Exercises the sizing rules in CSS2.1 10.3.2 and 10.6.2 with box-sizing:border-box for replaced elements with intrisic width and no intrinsic ratio, to check that they work correctly in terms of the content width height.

Source

 1 <!DOCTYPE html>
 2 <html><head><meta charset="utf-8">
 3 <title>CSS Basic User Interface Test: box-sizing:border-box and auto sizing of replaced elements with intrinisic width only.</title>
 4 <link href="http://florian.rivoal.net/" rel="author" title="Florian Rivoal">
 5 <link href="https://drafts.csswg.org/css-ui-3/#box-sizing" rel="help">
 6 <link href="http://www.w3.org/TR/CSS21/visudet.html#inline-replaced-width" rel="help">
 7 <link href="http://www.w3.org/TR/CSS21/visudet.html#inline-replaced-height" rel="help">
 8 <meta content="svg" name="flags">
 9 <link href="reference/box-sizing-008-ref.htm" rel="match">
10 <meta content="Exercises the sizing rules in CSS2.1 10.3.2 and 10.6.2 with box-sizing:border-box for replaced elements with intrisic width and no intrinsic ratio, to check that they work correctly in terms of the content width height." name="assert">
11 <style>
12 #ref {
13 	width: 100px;
14 	height: 150px;
15 	background: green;
16 	margin: 10px;
17 	display: inline-block;
18 }
19 img {
20 	box-sizing: border-box;
21 	width: auto;
22 	height: auto;
23 	background: white;
24 	margin: 10px;
25 }
26 
27 #t01 {
28 	padding-left: 20px;
29 	margin-left: -10px; /*not strictly necessary, but helps preserve alignment, which makes visual verification easier. */
30 }
31 #t02 {
32 	padding-bottom: 20px;
33 	margin-bottom: -10px; /*not strictly necessary, but helps preserve alignment, which makes visual verification easier. */
34 }
35 #t03 {
36 	width: 120px;
37 	padding-left: 20px;
38 	margin-left: -10px; /*not strictly necessary, but helps preserve alignment, which makes visual verification easier. */
39 }
40 #t04 {
41 	height: 170px;
42 	padding-bottom: 20px;
43 	margin-bottom: -10px; /*not strictly necessary, but helps preserve alignment, which makes visual verification easier. */
44 }
45 body {
46 	max-width: 400px;
47 }
48 </style>
49 </head><body>
50   <p>Test passes if there are 6 <strong>filled green rectangles</strong> and they are the <strong>same size</strong>.</p>
51   <div id="ref"></div>
52   <img src="support/w100.svg" id="t00">
53   <img src="support/w100.svg" id="t01">
54   <img src="support/w100.svg" id="t02">
55   <img src="support/w100.svg" id="t03">
56   <img src="support/w100.svg" id="t04">
57 
58 </body></html>