tor-browser

The Tor Browser
git clone https://git.dasho.dev/tor-browser.git
Log | Files | Refs | README | LICENSE

auto-margins-001.html (2091B)


      1 <!DOCTYPE html>
      2 <html>
      3 <head>
      4 <title>CSS Test: Aligning with auto margins</title>
      5 <link href="support/flexbox.css" rel="stylesheet">
      6 <link rel="stylesheet" type="text/css" href="/fonts/ahem.css" />
      7 <link rel="author" title="Google Inc." href="http://www.google.com/">
      8 <link rel="help" href="https://drafts.csswg.org/css-flexbox/#auto-margins">
      9 <link rel="match" href="auto-margins-001-ref.html">
     10 <style>
     11 
     12 #circles, #circles div {
     13    display: flex;
     14    width: -webkit-calc(100% - 4em);
     15    width: calc(100% - 4em);
     16    height: -webkit-calc(100% - 4em);
     17    height: calc(100% - 4em);
     18    border: 1em solid blue;
     19    border-radius:50%;
     20    margin: auto;
     21 }
     22 
     23 #circles { width:9em; height:9em; }
     24 
     25 </style>
     26 </head>
     27 <body>
     28 <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>
     29 
     30 <p>The black rectangle should be centered vertically and horizontally.</p>
     31 <div class="flexbox" style="width: 4em; height: 4em; background: silver">
     32  <p id="ok" style="margin: auto; font-family: Ahem;">OK</p>
     33 </div>
     34 
     35 <div class="flexbox" style="width: 4em; height: 4em; margin-top: 10px; background: silver; writing-mode: vertical-rl">
     36  <p id="okVertical" style="margin: auto; font-family: Ahem;">OK</p>
     37 </div>
     38 
     39 <p>You should see 3 blue concentric circles.</p>
     40 <div id="circles"><div><div></div></div></div>
     41 
     42 <p id="log">The computed style of each margin should not be 0.</p>
     43 <script>
     44 var okStyle = getComputedStyle(document.getElementById('ok'));
     45 document.getElementById("log").innerHTML += "<br>OK: " +
     46    ((parseInt(okStyle.marginTop) && parseInt(okStyle.marginRight) && parseInt(okStyle.marginBottom) && parseInt(okStyle.marginLeft)) ? "PASS" : "FAIL");
     47 
     48 var okVerticalStyle = getComputedStyle(document.getElementById('okVertical'));
     49 document.getElementById("log").innerHTML += "<br>Vertical OK: " +
     50    ((parseInt(okVerticalStyle.marginTop) && parseInt(okVerticalStyle.marginRight) && parseInt(okVerticalStyle.marginBottom) && parseInt(okVerticalStyle.marginLeft)) ? "PASS" : "FAIL");
     51 </script>
     52 </body>
     53 </html>