Skip to content

Grid

Elevate CSS simplifies CSS Grid layouts by introducing a series of concise shorthands for defining grid properties. This guide explains how to use the grid property with modifiers for rows, columns, and gaps as well as setting row and column spans with the row-spans and col-spans properties.


grid Property Modifiers

Elevate supports the following modifiers for the grid property:

ModifierExpected ValuesExample
RowsNumericToken (e.g., 2, up to 12)grid:rows-2
ColsNumericToken (e.g., 4, up to 12)grid:cols-4
GapSpacingToken (e.g., d3)grid:gap-d3
xGapSpacingToken (e.g., d3)grid:xgap-d3
yGapSpacingToken (e.g., d3)grid:ygap-d3

row-spans and col-spans Property Modifiers

The row-spans and col-spans properties can be used to specify the number of rows or columns a cell should span across. These properties accept the following syntax:

ModifierExpected ValuesExample
FromNumericToken (e.g., 2, up to 12) or allcol-spans-all
ToNumericToken (e.g., 4, up to 12) or allrow-spans:from-1:to-3





auto Property Modifiers

The auto properties utilize the passthrough token to allow for more traditionally robust control over the layout of grid items. These properties accept the following syntax:

ModifierExpected ValuesExample
’auto-col’PassThroughToken (e.g., (minmax(100px, auto)) )auto-col:(minmax(100px, auto))
’auto-row’PassThroughToken (e.g., (minmax(20%, 80vmax)) )auto-row:(minmax(20%, 80vmax))
’auto-flow’PassThroughToken (e.g., (row dense) )auto-flow:(row dense)

Examples of Grid Layouts

Elevate CSS ensures creating grid layouts is intuitive and concise, enabling dynamic design with minimal effort while simultaneously preserving the power and flexibility of CSS Grid.

<!-- Declaring a Grid Layout -->
<div class="grid:gap-d3:rows-2:cols-4">
<div class = "col-spans:from-1:to-3"></div>
</div>