Permalink
Cannot retrieve contributors at this time
Name already in use
A tag already exists with the provided branch name. Many Git commands accept both tag and branch names, so creating this branch may cause unexpected behavior. Are you sure you want to create this branch?
teutonic-css/includes/_grid.scss
Go to fileThis commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
32 lines (27 sloc)
1.09 KB
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Grid | |
// | |
// This is a "rigid" CSS grid based grid system | |
// It aims to replace standard float:left systems | |
// It's based on 12 columns by default | |
// calc stuff seems complicated, but the only way I know | |
// not run into too much overflow trouble with bigger gaps | |
// Based on Michael_Bs answer here: | |
// https://stackoverflow.com/questions/45090726/ | |
.grid { | |
// MODIFY: Number of columns, best: 8 - 18 | |
--grid-cols: 12; | |
// There is one less Gap than Columns | |
--grid-gaps: calc(var(--grid-cols) - 1); | |
// Percentage for each col | |
--col-size: calc(100%/var(--grid-cols)); | |
// Total Space in Grid occupied within the Gaps | |
--gap-total: calc(var(--gap-space, 0px) * var(--grid-gaps)); | |
// Space to substract by each col for gaps | |
--gap-subst: calc(var(--gap-total) / var(--grid-cols)); | |
display: grid; | |
// Default 12 columns 8.333333% - ……… | |
grid-template-columns: repeat(var(--grid-cols), calc(var(--col-size) - var(--gap-subst))); | |
grid-gap: var(--gap-space, 0px); | |
gap: var(--gap-space, 0px); // supposed standard | |
grid-auto-flow: dense; // opinionated | |
} |