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: menu; } .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' 'menu main main main right right' 'menu footer footer footer footer footer'; grid-gap: 10px; background-color: #ccc; padding: 10px; } .grid-container > div { background-color: #eee; text-align: center; padding: 20px 0; font-size: 30px; } </style> </head> <body> <h2>Grid-template-areas property example</h2> <div class="grid-container"> <div class="box1">Header</div> <div class="box2">Menu</div> <div class="box3">Main</div> <div class="box4">Right</div> <div class="box5">Footer</div> </div> </body> </html>