Source Code:
(back to article)
Submit
Result:
Report an issue
<!DOCTYPE html> <html> <head> <title>Title of the document</title> <style> .box1 { grid-area: header; } .box2 { grid-area: left; } .box3 { grid-area: main; } .box4 { grid-area: right; } .box5 { grid-area: footer; } .grid-container { display: grid; grid-template-areas: 'header header header header header header' 'left main main main right right' 'left footer footer footer footer footer'; grid-gap: 5px; background-color: #555; padding: 10px; } .grid-container > div { background-color: #ccc; text-align: center; padding: 30px 0; font-size: 30px; } </style> </head> <body> <h2>Grid-area property example</h2> <p>You can use the grid-area property to name grid items.</p> <div class="grid-container"> <div class="box1">Header</div> <div class="box2">Left</div> <div class="box3">Main</div> <div class="box4">Right</div> <div class="box5">Footer</div> </div> </body> </html>