contain-inline-size-grid-auto-fit.html (738B)
1 <!DOCTYPE html> 2 <html> 3 <head> 4 <link rel="author" title="Sammy Gill" href="mailto:sammy.gill@apple.com"> 5 <link rel="help" href="https://www.w3.org/TR/css-contain-2/#containment-size"> 6 <link rel="help" href="https://drafts.csswg.org/css-grid-2/#auto-repeat"> 7 <link rel="match" href="../reference/ref-filled-green-100px-square-only.html"> 8 <style> 9 .container { 10 width: 100px; 11 } 12 .grid { 13 display: grid; 14 height: 100px; 15 grid-template-columns: repeat(auto-fit, minmax(0, 1fr)); 16 contain: inline-size; 17 } 18 .grid-item { 19 background-color: green; 20 } 21 </style> 22 </head> 23 <body> 24 <p>Test passes if there is a filled green square.</p> 25 <div class="container"> 26 <div class="grid"> 27 <div class="grid-item"> 28 </div> 29 </div> 30 </div> 31 </body> 32 </html>