<div class="parent">
<header>Header</header>
<div class="left-side">Left Sidebar</div>
<main>Main Content</main>
<div class="right-side">Right Sidebar</div>
<footer>Footer</footer>
</div>
/* Fonts */
@import url("https://fonts.googleapis.com/css2?family=Open+Sans:wght@300;400;500;600;700;800&display=swap");
/* Resets */
*,
*::before,
*::after {
margin: 0;
padding: 0;
box-sizing: border-box;
}
/* Base Style */
body {
color: white;
font-family: "Open Sans", sans-serif;
font-size: 1.5rem;
}
.parent > * {
padding: 1rem;
}
header {
background-color: #251947;
border: 4px solid #6f35f1;
}
.left-side {
background-color: #414819;
border: 4px solid #859433;
}
main {
background-color: #461947;
border: 4px solid #923394;
}
.right-side {
background-color: #1b4b40;
border: 4px solid #369680;
}
footer {
background-color: #251947;
border: 4px solid #6f35f1;
}
/* Mobile Styles */
.parent {
display: grid;
grid-template-areas:
"head"
"left"
"main"
"right"
"foot";
min-height: 100vh;
}
.parent > header,
footer {
display: flex;
align-items: center;
}
header {
grid-area: head;
}
.left-side {
grid-area: left;
}
main {
grid-area: main;
}
.right-side {
grid-area: right;
}
footer {
grid-area: foot;
}
/* Tablet styles */
@media screen and (min-width: 500px) {
.parent {
grid-template-columns: 0.5fr 1fr;
grid-template-rows: 100px 1fr 1fr 100px;
grid-template-areas:
"head head"
"left main"
"right main"
"foot foot";
}
}
/* laptop and desktop styles */
@media screen and (min-width: 960px) {
.parent {
grid-template-columns: 200px 1fr 200px;
grid-template-areas:
"head head head"
"left main right"
"left main right"
"foot foot foot";
}
}
This Pen doesn't use any external CSS resources.
This Pen doesn't use any external JavaScript resources.