grid-item-aspect-ratio-stretch-2.html (1369B)
1 <!doctype html> 2 <meta charset="utf-8"> 3 <title>stretching works for replaced items with a fallback aspect ratio</title> 4 <link rel="author" title="Mats Palmgren" href="mailto:mats@mozilla.com"> 5 <link rel="author" title="Mozilla" href="https://mozilla.org"> 6 <link rel="help" href="https://drafts.csswg.org/css-grid"> 7 <link rel="help" href="https://bugzilla.mozilla.org/show_bug.cgi?id=1656281"> 8 <link rel="help" href="https://github.com/w3c/csswg-drafts/issues/6286#issuecomment-866986544"> 9 <link rel="match" href="grid-item-aspect-ratio-stretch-2-ref.html"> 10 <meta name="fuzzy" content="maxDifference=0-1; totalPixels=0-2"> 11 <style> 12 body { 13 line-height: 0; 14 } 15 16 div { 17 display: inline-grid; 18 grid-template: 100% / 100%; 19 height: 250px; 20 width: 350px; 21 background: grey; 22 margin: 10px; 23 vertical-align: top; 24 } 25 26 .justify { 27 justify-self: stretch; 28 } 29 .align { 30 align-self: stretch; 31 } 32 </style> 33 <div> 34 <img class="align justify"> 35 </div> 36 <div> 37 <img class="align"> 38 </div> 39 <div> 40 <img class="justify"> 41 </div> 42 <div> 43 <img> 44 </div> 45 46 <script> 47 var url = 'data:image/svg+xml,<svg xmlns="http://www.w3.org/2000/svg" width="20px" viewBox="0 0 50 100"><circle cx="50%" cy="50%" r="50%" fill="blue"/></svg>' 48 var imgs = document.querySelectorAll('img'); 49 for (var i = 0; i < imgs.length; ++i) { 50 var img = imgs[i]; 51 img.src = url; 52 } 53 </script>