section { display: grid; grid-template-columns: repeat(3, 1fr); grid-template-rows: 100px 50vh 100px; grid-template-areas: "header header header" "main main aside" "footer footer aside"; } header { background-color: crimson; grid-area: header; } main { background-color: hotpink; grid-area: main; } aside { background-color: lightsalmon; grid-area: aside; } footer { grid-area: footer; }
body { font-family: sans-serif; padding: 20px; } section { background-color: gold; } section > * { background-color: tomato; border-bottom: 2px solid firebrick; border-right: 2px solid firebrick; padding: 5px; }
<!doctype html> <html> <head> <meta charset="utf-8"> <meta name="viewport" content="width=device-width, initial-scale=1"> <link href="../assets/reset.css" rel="stylesheet"> <link href="setup.css" rel="stylesheet"> <link href="style.css" rel="stylesheet"> </head> <body> <section> <header> <p>Item 1 will span across the top</p> </header> <main> <p>Item 2 with a lot of text in it that takes up some space, again I am writing this manually for some reason, but we’re already here so I may as well just keep writing nonsense to increase the height and show the layout better</p> </main> <aside> <p>Item 3 continues down the side</p> </aside> <footer> <p>Item 4 might also have enough text to wrap and add height</p> </footer> </section> </body> </html>