<div class="app">
<header>
Basic Application
</header>
<main>
<!-- Left sidebar -->
<aside>
Sidebar
</aside>
<!-- Main content -->
<article>
<p>
How did the doctor revive the developer? The dev wasn’t responsive so the doc picked him up by his bootstraps
</p>
<button class="toggleButton" onclick="toggleMode()">Toggle Mode</button>
</article>
</main>
</div>
:root {
/* Background Colors */
--headerBg: #001b38;
--sidebarBg: #ba324f;
--articleBg: #f2f2f4;
/* Text Colors */
--articleTextColor: #999999;
--headerTextColor: #9aa1b5;
--sidebarTextColor: #f9aaaa;
--toggleButtonBackground: #333;
--toggleButtonColor: #fff;
}
.dark {
/* Background Colors */
--headerBg: #525252;
--sidebarBg: #414141;
--articleBg: #313131;
/* Text Colors */
--articleTextColor: rgba(255, 255, 255, 0.3);
--headerTextColor: rgba(255, 255, 255, 0.8);
--sidebarTextColor: rgba(255, 255, 255, 0.5);
--toggleButtonBackground: #fff;
--toggleButtonColor: #000;
}
.flower {
/* Background Colors */
--headerBg: #ee4540;
--sidebarBg: #c72c41;
--articleBg: #f67280;
/* Text Colors */
--articleTextColor: rgba(0, 0, 0, 0.6);
--headerTextColor: rgba(255, 255, 255, 0.8);
--sidebarTextColor: #fff;
}
/* The properties and declarations below will remain the same */
.app {
display: flex;
flex-direction: column;
height: 100vh;
}
header {
background: var(--headerBg);
padding: 10px;
color: var(--headerTextColor);
font-weight: bold;
}
main {
flex-grow: 1;
display: flex;
flex-direction: row;
}
aside {
min-width: 150px;
background: var(--sidebarBg);
color: var(--sidebarTextColor);
padding: 20px 10px;
font-weight: bold;
}
article {
flex-grow: 1;
background: var(--articleBg);
padding: 10px 20px;
font-size: 28px;
color: var(--articleTextColor);
}
/* Toggle Button */
.toggleButton {
position: absolute;
right: 25px;
bottom: 25px;
font-size: 14px;
padding: 20px;
border-radius: 5px;
background: var(--toggleButtonBackground);
color: var(--toggleButtonColor);
animation: bounce 0.5s ease alternate infinite;
}
@keyframes bounce {
to {
transform: translateY(-5px);
}
}
const app = document.getElementsByClassName("app")[0];
const toggleMode = () => {
app.classList.toggle("dark");
};
This Pen doesn't use any external CSS resources.
This Pen doesn't use any external JavaScript resources.