column-justify-items-center-001-ref.html (953B)
1 <!DOCTYPE html> 2 <html> 3 <style> 4 .grid { 5 display: grid; 6 grid-template-columns: repeat(3, 100px); 7 background: gray; 8 width: 300px; 9 align-items: start; 10 justify-items: center; 11 } 12 .flex { 13 display: flex; 14 align-items: center; 15 flex-direction: column; 16 } 17 .two-span-item { 18 background-color: lightpink; 19 } 20 .fifty-width { 21 width: 50px; 22 background-color: lightblue; 23 } 24 </style> 25 <body> 26 <p>Test that using justify-items centers each item to the grid-axis track it is on.</p> 27 <div class="grid"> 28 <div class="flex"> 29 <div class="fifty-width"> 30 This is some text 31 </div> 32 <div class="two-span-item"> 33 This is text 34 </div> 35 <div class="two-span-item"> 36 This is text 37 </div> 38 </div> 39 <div class="fifty-width"> 40 Some larger words in this sentence 41 </div> 42 <div class="fifty-width"> 43 The cat cannot be taken from milk 44 </div> 45 </div> 46 </body> 47 </html>