Core Grid

Core Grid System v1.10.1

Core Grid is a dynamic mobile first Sass/CSS grid. Core grid uses traditional float based columns to provide the best browser support. In addition helper classes for flexbox are included that can progressively enhance UI layouts.


Download on GitHub

Primary Grid

The first primary default is optimized for single column mobile first layout. All columns start at a width of 100%. Use the specified class name to trigger columns at the corresponding container width. The class structure is the following (.column-width-breakpoint)

Example ".col-6-md"

  • ".col" defines that you want a column.
  • "-6" defines how many columns you want the column to span.
  • "-md" defines the default breakpoint you would like your column width to be triggered at.

Extra Small devices Phones Small devices Phones/Tablets (≥540px) Medium devices Tablets/Laptops (≥720px) Large devices Laptop/Desktop (≥960px)
Behavior Always horizontal Width 100% to start, horizontal at above breakpoints
Container width Auto 540px 720px 960px
CSS Class .col-1-xs .col-1-sm .col-1-md (or) .col-1 .col-1-lg
Nestable Yes
Columns 12
Column width 8.333% at specified breakpoint
Gutter width 8px width, right and left of column. 16px bottom



.col-6-sm

.col-6-sm

.col-4-md

.col-4-md

.col-4-md

.col-3-lg

.col-3-lg

.col-3-lg

.col-3-lg

Dynamic Layouts

Core Grid allows dynamic changing of column sizes. Example below we have four containers. By default they are 100% in width. At our "-sm" breakpoint they will span the width of 6 columns. The second class "-lg" defines our second change that will occur at the large breakpoint. This will trigger the columns to span 3 columns wide.

.col-6-sm .col-3-lg

.col-6-sm .col-3-lg

.col-6-sm .col-3-lg

.col-6-sm .col-3-lg

Grid Layout

.col-1

.col-1

.col-1

.col-1

.col-1

.col-1

.col-1

.col-1

.col-1

.col-1

.col-1

.col-1

.col-2

.col-2

.col-2

.col-2

.col-2

.col-2

.col-3

.col-3

.col-3

.col-3

.col-4

.col-4

.col-4

.col-6

.col-6

.col-12

.col-5

.col-7

.col-8

.col-4

Containing Classes (max-width)

Using containing classes you can contain elements width proportionally to the max width of the ".container" class. This allows columns to be created that are flexible but do not scale with the view port. Example if we add a ".col-6-contain" the element max width will be half of the ".container" class width. (1100/2 = 550px). This can be useful for setting a max width on objects such as forms.

.col-8-contain (max-width: 733.33333px)

.col-6-contain (max-width: 550px)

.col-4-contain (max-width: 366.66667px)

Utilities

By leveraging Sass we can have a true mobile first responsive grid and still support older IE versions. Using special Sass mixins we can create a separate old IE style sheet for a fixed grid for our media queries to support ie8 and below. To read more on this please read Jake Archibalds great blog post here.

Core Grid contains multiple helper classes to show and hide content to the corresponding grid breakpoints.

Extra Small devices Phones Small devices Phones/Tablets (≥540px) Medium devices Tablets/Laptops (≥720px) Large devices Laptop/Desktop (≥960px)
Container width auto 540px 720px 960px
.visible Visible Visible Visible Visible
.hidden Hidden Hidden Hidden Hidden
.visible-xs Visible Visible Visible Visible
.visible-sm Hidden Visible Visible Visible
.visible-md Hidden Hidden Visible Visible
.visible-lg Hidden Hidden Hidden Visible
.hidden-xs Hidden Hidden Hidden Hidden
.hidden-sm Visible Hidden Hidden Hidden
.hidden-md Visible Visible Hidden Hidden
.hidden-lg Visible Visible Visible Hidden

Flexbox Helpers

Flexbox is the new standard for CSS layout. Flexbox is only used in core grid for minor layout enhancements as browser support for flexbox is still not widely supported (ie11+). The flexbox helper classes can help achieve same column heights and vertical alignment with the core grid. Flexbox helpers should not be used for critical layout features unless ie10+ is suitable with the project. Learn about flexbox


/* --- Flexbox helpers included --- */
.flex 
.flex-row 
.flex-vertical-align 
.flex-horizontal-align 
.flex-full-height 

Flexbox Examples

Here are some simple examples of what the flexbox helpers can accomplish.

I am a flex item with more content than the rest. I am a flex item with more content than the rest. I am a flex item with more content than the rest. I am a flex item with more content than the rest. I am a flex item with more content than the rest. I am a flex item with more content than the rest.

I am a item with .flex-vertical-align this centers me vertically withing my parent flex container (.flex-row)

I am a item with .flex this makes me a flex-item of my parent flex container (.flex-row)

I am a item with .flex this makes me a flex-item of my parent flex container (.flex-row)

Flexbox horizontal and vertical centering

Vertical and Horizontal centering with flexbox.

Layout Helpers

Layout helpers are for elements or small modules that only need a small layout change such as display: inline to display: block;. Layout helper classes should not be used on modules or elements that have Sass modules or classes already applied.


/* --- Layout helpers --- */
.display-none {
    display: none;
}
.display-none-important {
    display: none !important;
}
.display-block {
    display: block;
}
.display-inline-block {
    display: inline-block;
}
.visible-hidden {
    visibility: hidden;
}
.block-center {
    margin-left: auto;
    margin-right: auto;
    display: block;
    float: none;
}
.float-left {
    float: left;
}
.float-right {
    float: right;
}
.full-width {
    width: 100%;
}
.clear-both {
    clear: both;
}
     
/* Line Hight Set http://csswizardry.com/2012/06/single-direction-margin-declarations/ */
html {
    font-size: 16px;
    line-height: 1.5rem;
}
     
h1, h2, h3, h4, h5, h6, hgroup,
ul, ol, dl, blockquote, p, address,
table, fieldset, figure, pre, .header, img {
    margin: 0;
    margin-bottom: 1.5rem;
}
      
/* Margin and Padding Helpers */
.margin-top {
    margin-top: 24px;
}
     
.margin-bottom {
    margin-bottom: 24px;
}
     
.margin-top-small {
    margin-top: 12px;
}
     
.margin-bottom-small {
    margin-bottom: 12px;
}
     
.padding-bottom-none {
    padding-bottom: 0;
}