I need a layout like so:
Here is my try:
:root {
box-sizing: border-box;
}
*,
*::before,
*::after {
box-sizing: inherit;
}
.grid-container {
display: grid;
grid-template-columns:
[full-start] minmax(0, 1fr)
[main-start] minmax(0, 55.625em) [main-end]
minmax(0, 1fr) [full-end];
}
.grid-container > * {
grid-column: full-start / full-end;
}
.header {
background: #0e9daf;
}
.main {
background: #9E9E9E;
grid-column: main-start;
}
.sidebar {
background: #dd9f32;
}
.footer {
background: #9b51e0;
}
<!DOCTYPE html>
<html lang="en-US">
<head>
<meta charset="UTF-8">
<meta name="viewport"
content="width=device-width, user-scalable=no, initial-scale=1.0, maximum-scale=1.0, minimum-scale=1.0">
<link rel="stylesheet" href="gridlayout.css">
<title>Document</title>
</head>
<body>
<div class="grid-container">
<header class="header">
Header
</header>
<main class="main">
Main
</main>
<aside class="sidebar">
Sidebar
</aside>
<footer class="footer">
Footer
</footer>
</div>
</body>
</html>
If the screen is wider, let's say a 1080p screen, the main content has gutters on the left and right side, but the header and footer extends the full page.
Think about something like this, but I'm achieving it with grid:
.main {
max-width: 800px;
margin: 0 auto;
}
On larger displays, I would like to split the main area in two portions, I need a content area (a list of all blog posts) and a sidebar on the right with widgets such as "recent posts", "search bar", etc). I need some gap (not much) between the content and sidebar.
On small screens, I would like the header first, the blog posts below the header, the widgets below the blog posts, and the footer last.
I'm not even sure if I approached this the right way. I would love to hear your opinions. Thank you.
