Skip to content

Grid

Intro

Karma CSS includes a powerful mobile-first flexbox grid system for building layouts of all shapes and sizes. It’s based on a 12 column layout and has multiple tiers, one for each media query range. You can use it with Sass mixins or our predefined classes

Grid Options

See how aspects of the grid system work across multiple devices with a handy table. All breakpoints and container widths are configurable within the variables. You can add or remove breakpoints as well as the number of columns in the grid.

xSmall Small Medium Large xLarge
< 576px ≥576px ≥768px ≥992px ≥1200px
Grid behavior Horizontal at all times Collapsed to start, horizontal above breakpoints
Max container width None (auto) 540px 720px 960px 1140px
Class prefix col- col-sm- col-md- col-lg- col-xl-
Number of columns 12
Gutter width 30px (15px on each side of a column)
Nestable Yes
Offsetting Yes
Ordering Yes

Auto Layout

Equal Width Columns

Here are two grid layouts that apply to every device and viewport, from xs to xl.

Setting One Column Width

You can also just set the width of one column and others will auto adjust

Responsive

All Breakpoints

Just using .col or .col-* classes means the grid is the same across all devices.

Stacked to Horizontal

Using a single set of .col-sm-* classes, you can create a basic grid system that starts out stacked on extra small devices before becoming horizontal on desktop (small) devices.

Mix and Match

Don’t want your columns to simply stack in some grid tiers? Use a combination of different classes for each tier as needed. See the example below for a better idea of how it all works.

No Gutters

The gutters between columns in our predefined grid classes can be removed with .no-gutters. This removes the negative margins from .row and the horizontal padding from all immediate children columns.

Here’s the source code for creating these styles. Note that column overrides are scoped to only the first children columns and are targeted via attribute selector. While this generates a more specific selector, column padding can still be further customised with spacing utilities.

.no-gutters {
    margin-right: 0;
    margin-left: 0;

    > .col,
    > [class*="col-"] {
        padding-right: 0;
        padding-left: 0;
    }
}

In practice, here’s how it looks. Note you can continue to use this with all other predefined grid classes (including column widths, responsive tiers, reorders, and more).

Ordering

Use the .order-* for controlling the visual order of your content.

Offsetting Columns

Move columns to the right using .offset-md-* classes. These classes increase the left margin of a column by * columns. For example, .offset-md-4 moves .col-md-4 over four columns.