Grid[ Variable Reference ]

Jellyfish's grid system is built on flexbox.

The grid consists of containers (.container), rows (.row) and columns (.col ).

A basic 2 column grid


    
1st column
2nd column

Containers

Content without a container will span the width of the viewport. To restrict content width and ensure consistency, wrap elements in a .container.

The .container is centered horizontally and can be customised at each breakpoint with the following settings: width, max-width, gutter (left/right). See breakpoints for information.

A container can be modified with the class .is-wide to extend to fill half of the normal gutter on the left/right. This is useful for pulling content outside of the normal container for emphasis.

Containers aren't mandatory - indeed this documentation doesn't use them, however they do usually prove useful for most websites!

Rows / Columns

Rows contain a number of .col elements, arranged horizontally. To preserve equal margins on the left and right, the only elements inside a .row should be .col elements.

Unlike most grid systems, Jellyfish allows you customise how many columns your grid will use. This is determined by the $cols variable.

Columns are equal-width by default, and expand to fill all available width.


        
1st column
1st column
2nd column
1st column
2nd column
3rd column

To size a column based on it's content, use .col-auto


        
.col
.col
.col-auto
.col

Making Columns Responsive

To set the width of a column, use the breakpoint-based modifier classes to target different viewport widths.


        
sm-3
sm-6
sm-3

Additional columns wrap to a new line.


        
sm-6
sm-6
sm-6

You can mix and match column sizes over different breakpoints. Jellyfish is mobile first, so classes / widths inherit upwards.


        
sm-6 md-3 lg-7
sm-6 md-9 lg-5
sm-6 lg-3
sm-6
sm-6 lg-4
sm-6 lg-auto

On the smallest screens, all columns will be 100% width unless you specifier a modifier with the name defined in the $base-col-name variable (default xs).


        
xs-6
xs-6
default

You can mix and match sized columns with unsized columns for flexibility. Unsized columns will take up equal widths of the remaining space.

Adding a modifier of .*-0 for a breakpoint will reset the behaviour of a column to fill all remaining space in the row.


        
default
sm-6
default
sm-3
sm-3
default
sm-3
sm-3
sm-3 lg-0

Offsetting Columns

Columns can be offset by using the .offset-$breakpoint-$cols modifiers. Offsets are inherited, and can be reset by using the class .offset-$breakpoint-0. When you offset a column, all columns that follow are pushed along.


        
sm-3
sm-6 offset-sm-3
sm-6 offset-sm-3
sm-3
sm-3
sm-6 offset-sm-3 offset-md-0
sm-3
sm-6 offset-sm-3 offset-md-2

Note: if you don't need to use offsets in your project, you can disable the css from being generated (and slightly reduce compiled filesize) by changing $grid-has-offset to false.

Reordering Columns

You can control the order of columns using the .order-$breakpoint-* modifiers. Note that columns without an order modifier will not be affected. Ordering is inherited, and can be reset by using the class .order-$breakpoint-0.


        
unordered
order-md-3
order-md-2
order-md-3 order-lg-0
order-md-2
order-md-1

Note: if you don't need to use ordering in your project, you can disable the css from being generated (and slightly reduce compiled filesize) by changing $grid-has-order to false.

Collapsing Columns

Columns have horizontal spacing (gutters) around them by default. Should you wish to remove this spacing, apply the .collapse class to the parent .row. You can target specific breakpoints with .collapse-$breakpoint and reset with .nocollapse-$breakpoint


        
col
col
collapsed col
collapsed col
collapsed at sm, reset at lg
collapsed at sm, reset at lg

Nested Grids

.row and .col elements can be infinitely nested within each other, so long as one golden rule is followed: A .row can only contain .col elements.


        

outer col md-8


inner md-8
inner md-4

outer col md-4


inner md-6
inner md-6