tor-browser

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

grid-block-axis-alignment-auto-margins-004.html (1509B)


      1 <!DOCTYPE html>
      2 <meta charset="utf-8">
      3 <title>CSS Grid Layout Test: Aligning grid items using 'auto' margins and relative sized rows</title>
      4 <link rel="author" title="Javier Fernandez Garcia-Boente" href="mailto:jfernandez@igalia.com">
      5 <link rel="help" title="10.2 Aligning with auto margins" href="https://drafts.csswg.org/css-grid/#auto-margins">
      6 <meta name="assert" content="The 'top' and 'bottom' margins must be recomputed whenever the grid's height changes.">
      7 <style>
      8  #grid {
      9      display: grid;
     10      position: relative;
     11      background: grey;
     12      grid-template-columns: 300px;
     13      grid-template-rows: 40% 60%;
     14      height: 500px;
     15      width: min-content;
     16  }
     17  #grid div {
     18    margin: auto 0px auto 0px;
     19  }
     20  #item1 {
     21      background: green;
     22      width: 25px;
     23      height: 50px;
     24  }
     25  #item2 {
     26      background: blue;
     27      width: 25px;
     28      height: 100px;
     29  }
     30 </style>
     31 <script src="/resources/testharness.js"></script>
     32 <script src="/resources/testharnessreport.js"></script>
     33 <script src="/resources/check-layout-th.js"></script>
     34 <div id="grid">
     35    <div id="item1"></div>
     36    <div id="item2"></div>
     37 </div>
     38 <script>
     39 setup({ explicit_done: true });
     40 document.fonts.ready.then(() => {
     41    item1.setAttribute("data-offset-y", "75");
     42    item2.setAttribute("data-offset-y", "300");
     43    checkLayout('#grid', false);
     44 
     45    grid.style.height = "300px";
     46 
     47    item1.setAttribute("data-offset-y", "35");
     48    item2.setAttribute("data-offset-y", "160");
     49    checkLayout('#grid', true);
     50 });
     51 </script>