JSFiddle - React, Tailwind, and code Playground
by ethanpil
HTML
<body>
<header class="fixed-header">Header Content</header>
<div class="grid-container">
<aside class="sidebar">Sidebar Content</aside>
<main class="content">Main Content Area</main>
</div>
<footer class="footer">Footer Content</footer>
</body>
</html>
CSS
/* Basic Reset */
* {
margin: 0;
padding: 0;
}
/* Fixed Header
body {
display: grid;
grid-template-rows: auto 1fr;
height: 100vh;
width: 100vw;
}
.fixed-header {
position: sticky;
top: 0;
background-color: #f5f5f5;
z-index: 100;
padding: 10px;
} */
/* Grid Container */
.grid-container {
display: grid;
grid-template-columns: 20% 80%;
gap: 10px;
}
/* Sidebar and Main Content */
.sidebar,
.content {
padding: 20px;
border: 1px solid #ccc;
}
/* Footer */
.footer {
background-color: #f5f5f5;
text-align: center;
padding: 10px;
}
/* Responsive Styles - Collapse Sidebar on Mobile */
@media (max-width: 768px) {
.grid-container {
grid-template-columns: 100%;
}
}