grid-tracks-stretched-with-different-flex-factors-sum.html (2797B)
1 <!DOCTYPE html> 2 <title>CSS Grid: 'stretch' content alignment on flex tracks.</title> 3 <link rel="author" title="Javier Fernandez" href="mailto:jfernandez@igalia.com"> 4 <link rel="help" href="https://drafts.csswg.org/css-align-3/#content-distribution"> 5 <link rel="help" href="https://drafts.csswg.org/css-align-3/#valdef-align-content-stretch"> 6 <meta name="assert" content="This test ensures that using flex tracks and 'stretch' value for the content alignment css properties work properly."/> 7 <link href="/css/support/grid.css" rel="stylesheet"/> 8 <link href="/css/support/alignment.css" rel="stylesheet"/> 9 10 <script src="/resources/testharness.js"></script> 11 <script src="/resources/testharnessreport.js"></script> 12 <script src="/resources/check-layout-th.js"></script> 13 <style> 14 body { 15 margin: 0; 16 } 17 18 .grid { 19 position: relative; 20 width: 200px; 21 height: 300px; 22 } 23 24 .fractionFlexTracks { 25 grid-template-columns: auto 0.25fr; 26 grid-template-rows: 0.2fr auto; 27 } 28 29 .flexTracks { 30 grid-template-columns: auto 1fr; 31 grid-template-rows: 1.5fr auto; 32 } 33 34 </style> 35 </head> 36 <body onload="checkLayout('.grid')"> 37 38 <div style="position: relative"> 39 <p>When the sum of all track's flex factor is < 1, they don't exhaust the available space, which is used to stretch the 'auto' sized tracks.</p> 40 <div class="grid fractionFlexTracks contentStretch" data-expected-width="200" data-expected-height="300"> 41 <div class="firstRowFirstColumn" data-offset-x="0" data-offset-y="0" data-expected-width="150" data-expected-height="60"></div> 42 <div class="firstRowSecondColumn" data-offset-x="150" data-offset-y="0" data-expected-width="50" data-expected-height="60"></div> 43 <div class="secondRowFirstColumn" data-offset-x="0" data-offset-y="60" data-expected-width="150" data-expected-height="240"></div> 44 <div class="secondRowSecondColumn" data-offset-x="150" data-offset-y="60" data-expected-width="50" data-expected-height="240"></div> 45 </div> 46 </div> 47 48 <div style="position: relative"> 49 <p>When the sum of all track's flex factor is >= 1, they exhaust the available space, hence the 'stretch' alignment is not applied to the 'auto' sized tracks.</p> 50 <div class="grid flexTracks contentStretch" data-expected-width="200" data-expected-height="300"> 51 <div class="firstRowFirstColumn" data-offset-x="0" data-offset-y="0" data-expected-width="0" data-expected-height="300"></div> 52 <div class="firstRowSecondColumn" data-offset-x="0" data-offset-y="0" data-expected-width="200" data-expected-height="300"></div> 53 <div class="secondRowFirstColumn" data-offset-x="0" data-offset-y="300" data-expected-width="0" data-expected-height="0"></div> 54 <div class="secondRowSecondColumn" data-offset-x="0" data-offset-y="300" data-expected-width="200" data-expected-height="0"></div> 55 </div> 56 </div> 57 </body>