<section>
<div class="container">
<header>Header</header>
<main>Main</main>
<aside>Sidebar</aside>
<footer>Footer</footer>
</div>
</section>
@import url("https://fonts.googleapis.com/css2?family=Exo:wght@600&display=swap");
* {
margin: 0;
padding: 0;
box-sizing: border-box;
}
body {
width: 100vw;
min-height: 100vh;
display: flex;
justify-content: center;
flex-direction: column;
gap: 20px;
font-family: "Exo", Arial, sans-serif;
background-color: #f7f7f7;
padding: 20px;
}
section {
max-width: 80vw;
width: 100%;
margin: 0 auto;
min-height: calc(80vh - 40px);
display: flex;
justify-content: center;
}
.container {
border: 1px dashed #f36;
box-shadow: 0 0 0 6px rgb(0 0 0 / 13%);
border-radius: 1px;
}
.container > * {
display: flex;
justify-content: center;
align-items: center;
padding: 10px;
gap: 5px;
color: #fff;
font-size: 1.2rem;
text-shadow: 1px 1px 0 rgb(0 0 0 / 0.5);
}
header {
background-color: #f1c2c6;
}
aside {
background-color: #dac2f1;
}
main {
background-color: #ccf1c2;
}
footer {
background-color: #c2e9f1;
}
.container {
display: grid;
grid-template-columns: [hd-col-start sb-col-start ft-col-start] 200px [sb-col-end mn-col-start] 1fr [hd-col-end mn-col-end ft-col-end];
grid-template-rows: [hd-row-start] 80px [hd-row-end sb-row-start] 1fr [sb-row-end ft-row-start] 60px [ft-row-end];
grid-gap: 1rem;
width: 100%;
grid-template-areas:
"header header"
"sidebar main"
"footer footer";
transition: all 0.2s linear;
}
header {
/* ①: grid-area: header; */
/* ②: grid-area: header-start / header-start / header-end / header-end; */
grid-row: header-start / header-end;
grid-column: header-start / header-end;
}
aside {
/* ①: grid-area: sidebar; */
/* ②: grid-area: sidebar-start / sidebar-start / sidebar-end / sidebar-end; */
grid-row: sidebar-start / sidebar-end;
grid-column: sidebar-start / sidebar-end;
}
main {
/* ①: grid-area: main; */
/* ②: grid-area: main-start / main-start / main-end / main-end; */
grid-rows: main-start / main-end;
grid-column: main-start / main-end;
}
footer {
/* ①: grid-area: footer; */
/* ②: grid-area: footer-start / footer-start / footer-end / footer-end; */
grid-rows: footer-start / footer-end;
grid-column: footer-start / footer-end;
}
This Pen doesn't use any external CSS resources.
This Pen doesn't use any external JavaScript resources.