4 <link href="resources/flexbox.css" rel="stylesheet">
7 #circles, #circles div {
10 width: -webkit-calc(100% - 4em);
11 width: calc(100% - 4em);
12 height: -webkit-calc(100% - 4em);
13 height: calc(100% - 4em);
14 border: 1em solid blue;
19 #circles { width:9em; height:9em; }
24 <p>These tests are from the spec: <a href="http://dev.w3.org/csswg/css3-flexbox/#auto-margins">http://dev.w3.org/csswg/css3-flexbox/#auto-margins</a>.</p>
26 <p>A black box should be centered vertically and horizontally.</p>
27 <div class="flexbox" style="width: 4em; height: 4em; background: silver">
28 <p id="ok" style="margin: auto; font-family: Ahem;">OK</p>
31 <div class="flexbox" style="width: 4em; height: 4em; margin-top: 10px; background: silver; -webkit-writing-mode: vertical-rl">
32 <p id="okVertical" style="margin: auto; font-family: Ahem;">OK</p>
35 <p>You should see 3 blue concentric circles.</p>
36 <div id="circles"><div><div></div></div></div>
38 <p id="log">The computed style of each margin should not be 0.</p>
40 var okStyle = getComputedStyle(document.getElementById('ok'));
41 document.getElementById("log").innerHTML += "<br>OK: " +
42 ((parseInt(okStyle.marginTop) && parseInt(okStyle.marginRight) && parseInt(okStyle.marginBottom) && parseInt(okStyle.marginLeft)) ? "PASS" : "FAIL");
44 var okVerticalStyle = getComputedStyle(document.getElementById('okVertical'));
45 document.getElementById("log").innerHTML += "<br>Vertical OK: " +
46 ((parseInt(okVerticalStyle.marginTop) && parseInt(okVerticalStyle.marginRight) && parseInt(okVerticalStyle.marginBottom) && parseInt(okVerticalStyle.marginLeft)) ? "PASS" : "FAIL");