column-justify-items-center-001.html (1188B)
1 <!DOCTYPE html> 2 <html> 3 <meta charset="utf-8"> 4 <title>CSS Grid Lanes Test: Centered alignment in grid axis</title> 5 <link rel="author" title="Celeste Pan" href="mailto:celestepan@microsoft.com"> 6 <link rel="help" href="https://drafts.csswg.org/css-grid-3/#alignment"> 7 <link rel="match" href="column-justify-items-center-001-ref.html"> 8 <style> 9 .grid-lanes { 10 display: grid-lanes; 11 background: gray; 12 position: relative; 13 flow-tolerance: 0; 14 grid-template-columns: repeat(3, 100px); 15 width: 300px; 16 justify-items: center; 17 } 18 19 .fifty-width { 20 width: 50px; 21 background-color: lightblue; 22 } 23 </style> 24 <body> 25 <p>Test that using justify-items centers each item to the grid-axis track it is on.</p> 26 <div class="grid-lanes"> 27 <div class="fifty-width"> 28 This is some text 29 </div> 30 <div class="fifty-width"> 31 Some larger words in this sentence 32 </div> 33 <div class="fifty-width"> 34 The cat cannot be taken from milk 35 </div> 36 <div style="background-color: lightpink; width: fit-content;"> 37 This is text 38 </div> 39 <div style="background-color: lightpink; width: fit-content;"> 40 This is text 41 </div> 42 </div> 43 </body> 44 </html>