Skip to main content

Grid System

Defined in less/_layout.less. The grid system uses the .gcols class with modifier classes for column count, spans, and responsive behavior.

Since v0.0.7, responsive modifiers support both media queries and CSS container queries.

Base usage

<div class="gcols col3">
<div>...</div>
<div>...</div>
<div>...</div>
</div>

Column count classes

ClassColumns
.col22 equal columns
.col33 equal columns
.col44 equal columns

Span modifiers (col4)

Used on .gcols.col4 to create asymmetric layouts:

ClassEffect
.span1-3last child spans 3
.span3-1first child spans 3
.span2-1-1first child spans 2
.span1-1-2last child spans 2
.span1-2-1second child spans 2

Span modifiers (col3)

ClassEffect
.span1-2last child spans 2
.span2-1first child spans 2

Alignment

Add .center to vertically align items:

<div class="gcols col2 center">...</div>

Responsive — media queries

Switch to fewer columns at a given breakpoint using -{bp} suffix:

<!-- 3 cols by default, 2 cols at tablet, 1 col at mobile -->
<div class="gcols col3 col2-tablet col1-mobile">
...
</div>

Available breakpoints: desktop-xxl, desktop-wide, desktop, laptop, tablet, mobile, xmobile.

PatternEffect
.col3-{bp}Switch to 3 cols at breakpoint
.col2-{bp}Switch to 2 cols at breakpoint
.col1-{bp}Switch to 1 col (stacked) at breakpoint

Responsive — container queries

Use the -c-{bp} suffix to respond to the container width instead of the viewport:

<div style="container-type: inline-size;">
<div class="gcols col3 col1-c-tablet">
...
</div>
</div>

The parent element must have container-type: inline-size set.

.cols — Flex-based layout

.cols is a flex alternative to .gcols for horizontal layouts:

<div class="cols">
<div>...</div>
<div>...</div>
</div>
ModifierEffect
.verticalflex-direction: column
.fulljustify-content: space-between
.fluidflex-wrap: wrap
.topalign-items: flex-start
.rightjustify-content: flex-end
.vertical.fullcolumn + stretch

Mixin-based grid

You can also use the .grid() mixin directly for custom grids:

.my-grid {
.grid(auto, repeat(3, 1fr), 24px);
}

See Layout Mixins for full reference.