grid-item-aspect-ratio-stretch-2-ref.html (1020B)
1 <!doctype html> 2 <meta charset="utf-8"> 3 <title>Reference: 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 <style> 7 body { 8 line-height: 0; 9 } 10 11 div { 12 display: inline-block; 13 height: 250px; 14 width: 350px; 15 background: grey; 16 margin: 10px; 17 vertical-align: top; 18 } 19 20 img { 21 display: block; 22 } 23 24 .justify { 25 width: 350px; 26 } 27 .align { 28 height: 250px; 29 } 30 </style> 31 <div> 32 <img class="align justify"> 33 </div> 34 <div> 35 <img class="align"> 36 </div> 37 <div> 38 <img class="justify"> 39 </div> 40 <div> 41 <img style="width:20px; height:40px"> 42 </div> 43 44 <script> 45 var url = 'data:image/svg+xml,<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 50 100"><circle cx="50%" cy="50%" r="50%" fill="blue"/></svg>' 46 var imgs = document.querySelectorAll('img'); 47 for (var i = 0; i < imgs.length; ++i) { 48 var img = imgs[i]; 49 img.src = url; 50 } 51 </script>