Home
CSS
CSS Grid Item
Tryit: Using grid-area to name grid items
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; grid-template-areas: 'header header header header header header' 'menu main main main main right' 'menu footer footer footer footer footer'; gap: 10px; background-color: dodgerblue; padding: 10px; } .grid-container > div { background-color: #f1f1f1; color:#000; padding: 10px; font-size: 30px; text-align: center; } .item1 { grid-area: header; } .item2 { grid-area: menu; } .item3 { grid-area: main; } .item4 { grid-area: right; } .item5 { grid-area: footer; } </style> </head> <body> <h1>The grid-area Property</h1> <p>You can use the <em>grid-area</em> property to name grid items.</p> <p>This grid layout contains six columns and three rows:</p> <div class="grid-container"> <div class="item1">Header</div> <div class="item2">Menu</div> <div class="item3">Main</div> <div class="item4">Right</div> <div class="item5">Footer</div> </div> </body> </html>