rasterfari.scss

rasterfari.scss is a Sass/SCSS based grid system, which will help you to build grid layouts of any scale and complexity. See Demo!

The key features are:

Install rasterfari.scss

Download

Download the latest version from Github

or get it from NPM

npm install --save-dev rasterfari-grid

Default Settings:

@import "path/to/rasterfari.scss";

/* some styles */

$rasterfari__cols: 12;                  /* Choose your prefered number of columns (default: 12) */
$rasterfari__gutter: 20px;              /* the width of the gutter between the columns (default: 20px) */
$rasterfari__namespace: '';             /* Prefix for the rasterfari classes (default: '') */
$rasterfari__breakpoints: (             /* Breakpoints */
    'medium': '(min-width: 40em)',      /* Use the names of the breakpoints as class-suffix in your markup */
    'large': '(min-width: 64em)'        /* Add a new breakpoint if you need to */
) !default;

/* some more styles */

Basic Usage

Every container which contains columns gets the class .grid
Every column gets the base class .grid__col, which translates to 100% of the available width.

By giving .grid__col a .grid__col--${number} modifier, you can decide how many columns you would like to span. ${number} can be every number starting from 1 up to $rasterfari__cols which is defined in the default settings.

12 cols
11 cols
1 col
10 cols
2 cols
6 cols
6 cols

Responsive Grid

By giving each .grid__col a suffixed modifier like .grid__col--${number}@${breakpoint} you can control at which breakpoint the span should take action. The name of the suffix ${breakpoint} is defined in the default settings.

Main Content

Nested Grid

Within every .grid__col can live another .grid which defines its own columns with its own modifiers. So, technically, the possibility to nest grids into each other is infinite.

Main Content

Nested Grid 1
Nested Grid 2
Nested Grid 3
Nested Grid 4

Push & Pull

Let's say, that the aside column is on the left side on large screens, so it comes first in visual terms. Although, in your markup and on small screens you would like to present the main content first. This is where these state classes come into play.

With the .is-pushed-by-${numberOfCols} and .is-pulled-by-${numberOfCols} states you are able to choreograph your visual layout independently from your markup. You might also use the @${breakpoint} suffix here to add a little more control over pushing and pulling at a certain viewport size.

Main Content
Aside
Main Content
Aside Left
Aside Right

Grid without Gutter

Add the .has-no-gutter state to .grid to remove the gutter between the columns.

Main Content

Middle-aligned Grid System

Add the .is-middle state to .grid to middle-align the columns

6 cols
6 cols
More Content
More Content...
More...

Bottom-aligned Grid System

Add the .is-bottom state to .grid to bottom-align the columns

6 cols
6 cols
More Content
More Content...
More...