Home
CSS
CSS Grid Item
Tryit: The align-self property
Run ❯
Get your
own
website
Result Size:
625 x 534
×
Change Orientation
Save Code
Change Theme, Dark/Light
Go to Spaces
<!DOCTYPE html> <html> <head> <style> .grid-container { display: grid; height: 300px; grid-template-columns: auto auto auto; gap: 10px; background-color: dodgerblue; padding: 10px; } .grid-container > div { background-color: #f1f1f1; color:#000; padding: 10px; font-size: 30px; text-align: center; } .item1 { align-self: start; } .item6 { align-self: center; } </style> </head> <body> <h2>The align-self property</h2> <p>The align-self property is used to align the content of a grid item along the column axis.</p> <div class="grid-container"> <div class="item1">Item 1</div> <div class="item2">Item 2</div> <div class="item3">Item 3</div> <div class="item4">Item 4</div> <div class="item5">Item 5</div> <div class="item6">Item 6</div> </div> </body> </html>