baseline-alignment-affects-intrinsic-size-003.html (4075B)
1 <!DOCTYPE html> 2 <meta charset="utf-8"> 3 <title>CSS Grid Layout Test: evaluate how the baseline affects the grid intrinsic size</title> 4 <link rel="author" title="Javier Fernandez" href="mailto:jfernandez@igalia.com"> 5 <link rel="help" href="https://drafts.csswg.org/css-grid/#alignment"> 6 <link rel="help" href="https://drafts.csswg.org/css-align-3/#baseline-align-self"> 7 <link rel="help" href="https://drafts.csswg.org/css-align-3/#align-by-baseline"> 8 <link rel="stylesheet" href="/fonts/ahem.css"> 9 <link rel="stylesheet" href="/css/support/alignment.css"> 10 <link rel="stylesheet" href="/css/support/grid.css"> 11 <meta name="assert" content="The grid intrinsic size is comptuted correctly, considering the effect of baseline alignment in the size of the column tracks"/> 12 <style> 13 body { margin: 0; } 14 .grid { 15 position: relative; 16 background: grey; 17 float: left; 18 margin: 5px; 19 text-orientation: sideways; 20 width: 350px; 21 font-family: Ahem; 22 line-height: 1; 23 grid-auto-flow: row; 24 } 25 .grid > :nth-child(1) { font-size:20px; } 26 .grid > :nth-child(2) { font-size:30px; } 27 .grid > :nth-child(3) { font-size:50px; } 28 .grid > :nth-child(4) { font-size:60px; } 29 .item { 30 border-width: 2px 5px 3px 4px; 31 border-style: solid; 32 padding: 6px 3px 7px 8px; 33 margin: 10px 6px 4px 12px; 34 } 35 .extraTopPadding { padding-top: 50px; } 36 .extraBottomPadding { padding-bottom: 50px; } 37 </style> 38 <script src="/resources/testharness.js"></script> 39 <script src="/resources/testharnessreport.js"></script> 40 <script src="/resources/check-layout-th.js"></script> 41 <script type="text/javascript"> 42 setup({ explicit_done: true }); 43 </script> 44 45 <body onload="document.fonts.ready.then(() => { runTests(); })"> 46 47 <p>Vertical LR 4x1 grid with parallel and orthogonal items.</p> 48 <div id="grid1" class="grid verticalLR contentStart itemsBaseline" data-expected-height="104"> 49 <div class="item" data-offset-x="12" data-offset-y="40" data-expected-width="40" data-expected-height="38">É</div> 50 <div class="item horizontalTB" data-offset-x="70" data-offset-y="46" data-expected-width="50" data-expected-height="48">É</div> 51 <div class="item" data-offset-x="138" data-offset-y="10" data-expected-width="70" data-expected-height="68">É</div> 52 <div class="item horizontalTB" data-offset-x="226" data-offset-y="22" data-expected-width="80" data-expected-height="78">É</div> 53 </div> 54 <div id="grid2" class="grid verticalLR contentStart itemsBaseline" data-expected-height="155"> 55 <div class="item extraTopPadding" data-offset-x="12" data-offset-y="10" data-expected-width="40" data-expected-height="82">É</div> 56 <div class="item horizontalTB extraBottomPadding" data-offset-x="70" data-offset-y="60" data-expected-width="50" data-expected-height="91">É</div> 57 <div class="item" data-offset-x="138" data-offset-y="24" data-expected-width="70" data-expected-height="68">É</div> 58 <div class="item horizontalTB" data-offset-x="226" data-offset-y="36" data-expected-width="80" data-expected-height="78">É</div> 59 </div> 60 61 <br clear="all"> 62 63 <script> 64 "use strict"; 65 function runTests() { 66 67 let values = [ "auto", "min-content", "max-content" ]; 68 let minValues = values.concat([ "0px" ]); 69 70 var grid1 = document.getElementById("grid1"); 71 var grid2 = document.getElementById("grid2"); 72 73 minValues.forEach(function (minValue) { 74 values.forEach(function (maxValue) { 75 76 grid1.id = "grid1-" + minValue + "-" + maxValue 77 grid2.id = "grid2-" + minValue + "-" + maxValue 78 79 grid1.style.gridTemplateColumns = "minmax(" + minValue + ", " + maxValue + ")"; 80 grid2.style.gridTemplateColumns = "minmax(" + minValue + ", " + maxValue + ")"; 81 82 checkLayout("#" + grid1.id, false); 83 checkLayout("#" + grid2.id, false); 84 }); 85 }); 86 87 done(); 88 } 89 </script> 90 91 </body>