Source Code:
(back to article)
Submit
Result:
Report an issue
<!DOCTYPE html> <html> <head> <title>Title of the document</title> <style> body { margin: 40px; } .sidebar { grid-area: sidebar; } .sidebar2 { grid-area: sidebar2; } .content { grid-area: content; } .header { grid-area: header; } .footer { grid-area: footer; } .wrapper { background-color: #eeeeee; color: #444; display: grid; grid-gap: 1em; grid-template-areas: "header" "sidebar" "content" "sidebar2" "footer" } @media only screen and (min-width: 500px) { .wrapper { grid-template-columns: 20% auto; grid-template-areas: "header header" "sidebar content" "sidebar2 sidebar2" "footer footer"; } } @media only screen and (min-width: 600px) { .wrapper { grid-gap: 20px; grid-template-columns: 120px auto 120px; grid-template-areas: "header header header" "sidebar content sidebar2" "footer footer footer"; max-width: 600px; } } .box { background-color: #444; color: #ffffff; border-radius: 5px; padding: 10px; font-size: 150%; } .header, .footer { background-color: #8ebf42; } .sidebar2 { background-color: #ccc; color: #444; } </style> </head> <body> <div class="wrapper"> <div class="box header">Header</div> <div class="box sidebar">Sidebar</div> <div class="box sidebar2">Sidebar 2</div> <div class="box content"> Content <br /> When you resize the browser this column will be quite tall. </div> <div class="box footer">Footer</div> </div> </body> </html>