4 <link href=
"resources/flexbox.css" rel=
"stylesheet">
7 #circles, #circles div {
9 width: -webkit-calc(
100% -
4em);
10 width: calc(
100% -
4em);
11 height: -webkit-calc(
100% -
4em);
12 height: calc(
100% -
4em);
13 border:
1em solid blue;
18 #circles { width:
9em; height:
9em; }
23 <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>
25 <p>The word OK should be centered vertically and horizontally.
</p>
26 <div class=
"flexbox" style=
"width: 4em; height: 4em; background: silver">
27 <p id=
"ok" style=
"margin: auto;">OK
</p>
30 <div class=
"flexbox" style=
"width: 4em; height: 4em; margin-top: 10px; background: silver; -webkit-writing-mode: vertical-rl">
31 <p id=
"okVertical" style=
"margin: auto;">OK
</p>
34 <p>You should see
3 blue concentric circles.
</p>
35 <div id=
"circles"><div><div></div></div></div>
37 <p id=
"log">The computed style of each margin should not be
0.
</p>
39 var okStyle
= getComputedStyle(document
.getElementById('ok'));
40 document
.getElementById("log").innerHTML
+= "<br>OK: " +
41 ((parseInt(okStyle
.marginTop
) && parseInt(okStyle
.marginRight
) && parseInt(okStyle
.marginBottom
) && parseInt(okStyle
.marginLeft
)) ? "PASS" : "FAIL");
43 var okVerticalStyle
= getComputedStyle(document
.getElementById('okVertical'));
44 document
.getElementById("log").innerHTML
+= "<br>Vertical OK: " +
45 ((parseInt(okVerticalStyle
.marginTop
) && parseInt(okVerticalStyle
.marginRight
) && parseInt(okVerticalStyle
.marginBottom
) && parseInt(okVerticalStyle
.marginLeft
)) ? "PASS" : "FAIL");