grid-aspect-ratio-040.html (626B)
1 <!DOCTYPE html> 2 <html> 3 <link rel="help" href="https://drafts.csswg.org/css-sizing-4/#aspect-ratio"> 4 <link rel="match" href="../../reference/ref-filled-green-100px-square.xht" /> 5 <style> 6 .grid { 7 display: grid; 8 width: 100px; 9 } 10 11 .item { 12 all: unset; 13 aspect-ratio: 1 / 1; 14 background-color: green; 15 height: 100%; 16 width: 100%; 17 } 18 </style> 19 20 <p id="text">Test passes if there is a filled green square and <strong>no red</strong>.</p> 21 22 <div class="grid"> 23 <div id="item" class="item"></div> 24 </div> 25 26 <script> 27 item.style.padding = "10px"; 28 document.body.offsetTop; 29 item.style.padding = "0px"; 30 </script>