Utility Classes

Utility classes are used to apply a single rule to a component. They can be used compositionally to modify elements as needed by a specific design context.

Spacing Classes

Below we describe a suite of utility classes to be used for spacing.

Available Classes

The utility classes available are of the following form:

  • .margin-[direction]-[size] - Margin of size [size] in direction [direction]
  • .padding-[direction]-[size] - Padding of size [size] in direction [direction]

Size can be

  • none - sets value to 0
  • tiny
  • small
  • medium
  • large
  • xlarge

Position can be

  • top
  • bottom
  • left
  • right
  • vert - top and bottom
  • horiz - left and right
  • absent (in which case, rule will apply both horizontally and vertically)

For example:

EXAMPLE

Show Code

<button class="margin-none button btn-cta">Marginless Button</button>

Display Classes

Use .block, .inline-block and .inline modify the display types of various elements.

EXAMPLE

Show Code

<!-- Displayed as block -->
<span class="block bg-light-grey padding-medium margin-bottom-medium">Block</span>

<!-- Displayed as inline-block -->
<span class="inline-block bg-light-grey padding-medium margin-right-medium">Inline-Block</span>

<!-- Displayed as inline -->
<span class="inline bg-light-grey margin-right-medium">Inline</span>
Block Inline-Block Inline

If you would like to hide an element altogether, use the .hide class.

EXAMPLE

Show Code

<span class="hide">You can&apos;t see me.</span>
You can't see me.

Alignment Classes

These classes are used to align elements.

Vertical Alignment

Use .valign-top, .valign-middle, and .valign-bottom to align elements vertically. Obviously, these may only apply to elements whose display property is set to either inline or inline-block.

EXAMPLE

Show Code

<!-- Alignment Guideline -->
<span class="inline-block valign-middle bg-light-grey padding-medium" style="height: 8rem">Alignment Guideline</span>

<!-- Alignment Examples -->
<span class="inline-block valign-top bg-medium-grey padding-medium">Align to Top</span>
<span class="inline-block valign-middle bg-medium-grey padding-medium">Align to Middle</span>
<span class="inline-block valign-bottom bg-medium-grey padding-medium">Align to Bottom</span>
Alignment Guideline Align to Top Align to Middle Align to Bottom

Always keep in mind that you cannot align an element vertically by itself! It needs another element to which it can align. A group of elements will vertically align to the tallest element in the group.

Text Alignment

Use .text-left, .text-center, and .text-right to align text horizontally.

EXAMPLE

Show Code

<p class="text-left">This text is left-aligned.</p>
<p class="text-center">This text is center-aligned.</p>
<p class="text-right">This text is right-aligned.</p>

This text is left-aligned.

This text is center-aligned.

This text is right-aligned.

Reset Classes

These classes are used to reset the styles needed by particular components.

Resetting lists

Use the .reset-list class to reset properties on a <ul> or <ol>.

EXAMPLE

Show Code

<!-- Standard List -->
<h3>The Four Seasons</h3>
<ul>
    <li>Winter</li>
    <li>Spring</li>
    <li>Summer</li>
    <li>Fall</li>
</ul>

<!-- Reset List -->
<h3>The Four Seasons, reset</h3>
<ul class="reset-list">
    <li>Winter</li>
    <li>Spring</li>
    <li>Summer</li>
    <li>Fall</li>
</ul>

The Four Seasons

  • Winter
  • Spring
  • Summer
  • Fall

The Four Seasons, reset

  • Winter
  • Spring
  • Summer
  • Fall

Resetting Buttons

Use the .reset-button class when you wish to reset properties on a <button>. This may be helpful if you need to style a custom button element.

EXAMPLE

Show Code

<!-- Standard Button -->
<button class="button btn-cta">Example Button</button>

<!-- Reset Button -->
<button class="reset-button button btn-cta">Reset Button</button>

Reseting Child-Margins

Use the .reset-child-margins class when you wish to supply margins on children but do not want them applied to the first or last elements.

EXAMPLE

Show Code

<div class="row padding-horiz-medium">
    <div class="small-4 padding-medium reset-child-margins" style="background-color: #F1F1F1;">

        <!-- This button has no top margin -->
        <button class="expand button btn-cta">Example Button</button>
        <button class="expand button btn-cta">Example Button</button>
        <button class="expand button btn-cta">Example Button</button>

        <!-- This button has no bottom margin -->
        <button class="expand button btn-cta">Example Button</button>
    </div>
</div>

Font Classes

Font smoothing

Antialiased font smoothing works best for light text on a dark background and can be appled to single elements or globally to body using the .antialiased class. Note this only applies to webkit-based desktop browsers and Firefox 25 (and later) on the Mac.

EXAMPLE

Show Code

<!-- Paragraph Text -->
<p class="antialiased">Lorem ipsum dolor sit amet, eu est tamquam meliore. Sed id graeco partiendo reprehendunt, vel at corrumpit appellantur, ius debet semper deserunt ut. Ex duo mundi nostro, pri ex mentitum offendit laboramus, ut his quas nulla error.</p>

<!-- Button Text -->
<button class="button btn-cta">Example Button</button>

Lorem ipsum dolor sit amet, eu est tamquam meliore. Sed id graeco partiendo reprehendunt, vel at corrumpit appellantur, ius debet semper deserunt ut. Ex duo mundi nostro, pri ex mentitum offendit laboramus, ut his quas nulla error.

Tabular Lining

Some themes supply a separate font used to apply tabular lining to numeric characters. This font may be applied to a component using the .text-tabular-lining utility class.

EXAMPLE

Show Code

<!-- Standard Text -->
<p>$199.99 - Standard Lining</p>

<!-- Tabular Figures -->
<p class="text-tabular-lining">$199.99 - Tabular Lining</p>

$199.99 - Standard Lining

$199.99 - Tabular Lining

Color Classes

A handful of helpful utility classes to add text and background colors.

Text Colors

Base Text Colors

EXAMPLE

Show Code

<p class="text-primary">This is text color primary.</p>
<p class="text-secondary">This is text color secondary.</p>
<p class="text-success">This is text color success.</p>
<p class="text-alert">This is text color alert.</p>
<p class="text-info">This is text color info.</p>
<p class="text-warning">This is text color warning.</p>

This is text color primary.

This is text color secondary.

This is text color success.

This is text color alert.

This is text color info.

This is text color warning.

Mute Text Colors

EXAMPLE

Show Code

<p class="text-primary-mute">This is text color primary mute.</p>
<p class="text-secondary-mute">This is text color secondary mute.</p>
<p class="text-success-mute">This is text color success mute.</p>
<p class="text-alert-mute">This is text color alert mute.</p>
<p class="text-info-mute">This is text color info mute.</p>
<p class="text-warning-mute">This is text color warning mute.</p>

This is text color primary mute.

This is text color secondary mute.

This is text color success mute.

This is text color alert mute.

This is text color info mute.

This is text color warning mute.

Neutral Text Colors

EXAMPLE

Show Code

<p class="padding-small bg-black text-white">This is text color white.</p>
<p class="text-medium-grey">This is text color medium grey.</p>
<p class="text-dark-grey">This is text color dark grey.</p>
<p class="text-off-black">This is text color off black.</p>
<p class="text-black">This is text color black.</p>

This is text color white.

This is text color medium grey.

This is text color dark grey.

This is text color off black.

This is text color black.

Background Colors

Base Background Colors

EXAMPLE

Show Code

<div class="padding-small margin-bottom-tiny text-white bg-primary">This is background color primary.</div>
<div class="padding-small margin-bottom-tiny text-white bg-secondary">This is background color secondary.</div>
<div class="padding-small margin-bottom-tiny text-white bg-success">This is background color success.</div>
<div class="padding-small margin-bottom-tiny text-white bg-info">This is background color info.</div>
<div class="padding-small margin-bottom-tiny text-white bg-alert">This is background color alert.</div>
<div class="padding-small margin-bottom-tiny text-white bg-warning">This is background color warning.</div>
This is background color primary.
This is background color secondary.
This is background color success.
This is background color info.
This is background color alert.
This is background color warning.

Pastel Background Colors

EXAMPLE

Show Code

<div class="padding-small margin-bottom-tiny text-white bg-primary-pastel">This is background color primary pastel.</div>
<div class="padding-small margin-bottom-tiny bg-secondary-pastel">This is background color secondary pastel.</div>
<div class="padding-small margin-bottom-tiny bg-success-pastel">This is background color success pastel.</div>
<div class="padding-small margin-bottom-tiny bg-alert-pastel">This is background color alert pastel.</div>
<div class="padding-small margin-bottom-tiny bg-info-pastel">This is background color info pastel.</div>
<div class="padding-small margin-bottom-tiny bg-warning-pastel">This is background color warning pastel.</div>
This is background color primary pastel.
This is background color secondary pastel.
This is background color success pastel.
This is background color alert pastel.
This is background color info pastel.
This is background color warning pastel.

Neutral Background Colors

EXAMPLE

Show Code

<div class="padding-small margin-bottom-tiny text-black bg-white">This is background color white.</div>
<div class="padding-small margin-bottom-tiny text-black bg-off-white">This is background color off white.</div>
<div class="padding-small margin-bottom-tiny text-black bg-light-grey">This is background color light grey.</div>
<div class="padding-small margin-bottom-tiny text-white bg-medium-grey">This is background color medium grey.</div>
<div class="padding-small margin-bottom-tiny text-white bg-dark-grey">This is background color dark grey.</div>
<div class="padding-small margin-bottom-tiny text-white bg-off-black">This is background color off black.</div>
<div class="padding-small margin-bottom-tiny text-white bg-black">This is background color black.</div>
This is background color white.
This is background color off white.
This is background color light grey.
This is background color medium grey.
This is background color dark grey.
This is background color off black.
This is background color black.

Text Classes

Text Casing

The .text-lower and .text-upper classes can be used for modifying the text casing.

EXAMPLE

Show Code

<p>This text is <span class="text-lower">Lowercase</span> and this text is <span class="text-upper">Uppercase</span>.</p>

This text is Lowercase and this text is Uppercase.