The Core grid system is based off of Bootstrap 4, with 12 columns over 5 seperately defined breakpoints.
How it Works
There are three major components—containers, rows, and columns:
- Containers—
.container
for 100% width up to the XL breakpoint or.container-fluid
for full width—center your site’s contents and help align your grid content. - Regardless of container type, within it a
.row
is required to surround all columns. - Content should be placed within columns, and only columns may be immediate children of rows.
Columns are named in a systemic way, to allow them to occupy different percentages of space at different breakpoints. They all begin with the .col-
designation, and the next portions define the breakpoint where it is first applied, and a numeric used to control the width percentage.
Breakpoints
Column breakpoints are additive, meaning they apply to the breakpoint specified and all those above it (e.g., .col-sm-4
applies to small, medium, large, and extra large window sizes):
Extra small <544px |
Small ≥544px |
Medium ≥768px |
Large ≥992px |
Extra large ≥1200px |
|
---|---|---|---|---|---|
Class prefix | .col-xs- |
.col-sm- |
.col-md- |
.col-lg- |
.col-xl- |
Column Width
Column width is determined as a fraction of the 12 columns per row, where the percentage width of a .col-xx-n
class is evaluated as n/12
. So if you want three equal-width columns, you’d use .col-xs-4
.
- Column widths are set in percentages, so they’re always fluid and sized relative to their parent element.
- Columns have
1rem
padding on each side to create the gutters between individual columns for a total gutter width of2rem
.
Usage
Rules
- Use the grid to constrain and align content at different breakpoints
Constraints
- When using the
.edge-*
modifier classes if grids are nested within the element, it will break the grid alignment and cause negative margin issues. For those reasons, if a container contains a grid place these utilities on the column elements, not the container element. Also take great care to only remove the left or right padding in cases with multiple columns, as removing interior gutter spaces could also throw off alignment.
Principles
- A grid is used to layout the content of a page in meaningful and consistent ways that are appropriate for variations in responsive layouts and available viewport space
Accessibility
- When using the
.col-xx-push-*
,.col-xx-pull-*
,.col-xx-first
or.col-xx-last
modifier classes to visually reorder columns, ensure that the content still has a logical and understandable flow in the DOM for screen readers
Class Names
container Required |
Use on the |
container-fluid Modifier |
Use on the |
row Required |
Use on the first nested |
col-*-# Required |
A |
col-*-offset-# Modifier |
Offset columns to the right. Use with the required column classes. This is handy when the number of columns does not add up to the amount set for the grid. The center |
col-*-push-# Modifier |
Push columns to the right to visually reorder them. Use with the required column classes and |
col-*-pull-# Modifier |
Pull columns to the left to visually reorder them. Use with the required column classes and |
col-*-first Modifier |
Visually change the order of the column within a row where the |
col-*-last Modifier |
Visually change the order of the column within a row where the |
row-*-top Modifier |
Use with |
row-*-center Modifier |
Use with |
row-*-bottom Modifier |
Use with |
row-*-baseline Modifier |
Use with |
col-*-top Modifier |
Use with the required column classes when using the flexbox version of the grid to align an individual column to the top of the row. The center |
col-*-center Modifier |
Use with the required column classes when using the flexbox version of the grid to align an individual column to the center of the row. The center |
col-*-bottom Modifier |
Use with the required column classes when using the flexbox version of the grid to align an individual column to the bottom of the row. The center |
edge-*-up Modifier |
Remove both left and right padding (gutter space) on either a |
edge-l-*-up Modifier |
Remove the left padding (gutter space) on either a |
edge-r-*-up Modifier |
Remove the right padding (gutter space) on either a |
edge-*-down Modifier |
Remove both left and right padding (gutter space) on either a |
edge-l-*-down Modifier |
Remove the left padding (gutter space) on either a |
edge-r-*-down Modifier |
Remove the right padding (gutter space) on either a |
- Last updated May 2, 2018
- Authorable - Yes
- Core - Grid System