Layout

Primer’s layout includes basic page containers and a single-tiered, fraction-based grid system. That sounds more complicated than it really is though—it’s just containers, rows, and columns.

You can find all the below styles in _layout.scss.

Contents

Container

Center your page’s contents with a .container.

<div class="container">
  <!-- contents here -->
</div>

The container applies width: 980px; and uses horizontal margins to center it.

Grid

How it works

The grid is pretty standard—you create rows with .columns and individual columns with a column class and fraction class. Here’s how it works:

  • Add a .container to encapsulate everything and provide ample horizontal gutter space.
  • Create your outer row to clear the floated columns with <div class="columns">.
  • Add your columns with individual <div class="column">s.
  • Add your fractional width classes to set the width of the columns (e.g., .one-fourth).

Demo

In practice, your columns will look like the example below.

.one-fifth
.four-fifths
.one-fourth
.three-fourths
.two-thirds
.one-half
.one-half
<div class="container">
  <div class="columns">
    <div class="one-fifth column">
      .one-fifth
    </div>
    <div class="four-fifths column">
      .four-fifths
    </div>
  </div>

  <div class="columns">
    <div class="one-fourth column">
      .one-fourth
    </div>
    <div class="three-fourths column">
      .three-fourths
    </div>
  </div>

  <div class="columns">
    <div class="one-third column">
      .one-third
    </div>
    <div class="two-thirds column">
      .two-thirds
    </div>
  </div>

  <div class="columns">
    <div class="one-half column">
      .one-half
    </div>
    <div class="one-half column">
      .one-half
    </div>
  </div>
</div>

Centered

Columns can be centered by adding .centered to the .column class.

.one-half
<div class="columns">
  <div class="one-half column centered">
    .one-half
  </div>
</div>