Grid Overview
Stylus Boilerplate ships with two types of grid systems:
- Traditional float-style grid on fixed columns
- Flexible, flex-box/table-based grid with unlimited columns
Traditional Float Grid
To use the traditional "float-style" grid, simply@extend
the col-{number}
class, where number
 corresponds with the amount of columns to span. For example, to achieve half a row on a grid with 12 columns, use the class @extend $col-6
Flexible Grid
Because flexbox isn't yet supported in older browsers, and is less performant than table layouts, I adapted a grid based off of mdo's table grid.
To use the grid system, simply wrap your elements in a .row
class, followed by any column elements within a .column
class.
Column Sizes
You can set column sizes in normal English, as you might expect:
Class | Width |
---|---|
.column | 100% |
.column .one-half | 50% |
.column .one-fourth | 25% |
.column .one-third | 33% |
... etc. |
.three-fourths
(Doesn't need a class. This will fold over.)
.one-third
(Doesn't need a class. This will fold over.)
(Doesn't need a class. This will fold over.)
.one-fourth
Auto-distributed column widths
Nested Grids
You can nest grids, using the same markup as a normal grid:
Single Column that's nested
Nested column 1
Nested column 2
Unnested column
Grids with Gutters
You can add spacing between the columns with the.row-padded
class:
Vertically-Aligned Columns
Simply use the class.column-align-middle
:
Distributed Row
You can "distribute" the contents of a row, such that content is aligned left and right with space between:
.column.one-third
.column.one-fifth
.column.one-half
.column.one-third
Note that using .row.distributed
only works on browsers that support display: flex
.