<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: [header-start sidebar-start] 200px [sidebar-end main-start footer-start] 1fr [header-end main-end footer-end];
grid-template-rows: [header-start] 80px [header-end sidebar-start main-start] 1fr [main-end footer-start] 60px [sidebar-end footer-end];
grid-gap: 1rem;
width: 100%;
transition: all 0.2s linear;
}
header {
grid-area: header;
}
aside {
grid-area: sidebar;
}
main {
grid-area: main;
}
footer {
grid-area: footer;
}
This Pen doesn't use any external CSS resources.
This Pen doesn't use any external JavaScript resources.