.grid {
display: grid;
grid-template-columns: 1fr 1fr;
grid-template-rows: 1fr 1fr;
}
.grid {
display: grid;
grid-template-columns: 2fr 2fr 1fr 2fr;
grid-template-rows: 100px 200px 100px;
grid-template-areas:
"head head . side"
"main main . side"
"footer footer footer footer";
}
.grid {
grid-template-areas:
"π©π½ π©π½ π©π½"
"π π π"
"π‘ π‘ π‘";
}
(or how I reduced 20k of CSS to 6k and removed a shedload of markup at the same time)
<header class="layout layout-header"></header>
<div class="layout">
<main class="layout-main"></main>
<aside class="sidebar layout-sidebar"></aside>
</div>
<footer class="layout layout-footer"></footer>
.layout {
display: grid;
grid-template-columns: repeat(12, 1fr);
grid-column-gap: 2rem;
}
.layout > * {
/* All grid elements to span 10 cols offset by 1 */
grid-column: 2 / span 10;
}
@media screen and (min-width: 1000px) {
.layout-main {
grid-column: 2 / span 5;
}
.layout-sidebar {
grid-column: 8 / span 4;
}
}
Feature queries
.block {
float: right;
}
@supports (display: grid) {
.block {
display: grid;
}
}
I think I may need to recalibrate the estimation part of my brain to account for just how powerful CSS grid is.Jeremy Keith