CSS Vars Framework has a mobile-first flexbox grid, twelve column system.
.col with no number
always splits the row evenly between however many columns you add — add
a fourth .col and all four become 25% wide automatically.Add the class col-auto instead of col when a column should only be as wide as its content — the remaining .col siblings share whatever space is left.
add col- with a number from 1 to 12 to set the size
Use col-sm- col-md- col-lg- col-xl- with any number from 1 to 12
The sum in each row must be 12,
Example:
col-sm-12 shows a full width column on small devices,
col-md-6 shows 2 columns on tablets, col-lg-3 shows 4
columns on desktop
Please, resize the window to see the changes on all devices.
Start a new row inside any col to build a sub-grid — the nested row's own 12 columns are relative to the width of the column it's inside, not the page.
In some cases we need to show a column first on large devices but last on small devices or visa versa
lg-order-first and
lg-order-last are the only reorder classes in the
framework — there's no sm-order-*, md-order-*,
or xl-order-* equivalent. Reordering only kicks in at the
992px breakpoint and up.Add classes gap, gap-1, gap-2, gap-3, gap-4 to set the gap between columns, No row break when using with the class row.
You can also use flex-nowrap to prevent wrapping of columns in a row, which is useful when you want to create a horizontal scrollable area with multiple columns.
Add classes child-padding, child-padding-1, child-padding-2, child-padding-3, child-padding-4 to the row to set padding on every column inside it, instead of adding padding to each column one by one
A row should sit inside a container so it has a page-width to divide up — use container for a boxed, max-width page, container-fluid for edge-to-edge, or container-half-fluid for full width that caps at 85% on very large screens.
Built with love by Kim Majali, EITO team, and contributors.