Foundation

Global Styles

Our global CSS includes helpful resets to ensure consistent styling across browsers.

Font Sizing

The default font size is set to 100% of the browser style sheet, usually 16 pixels. This ensures compatibility with browser-based text zoom or user-set defaults. If you're using the Sass version of Foundation, edit the $global-font-size variable to change the base font size. This can be a percentage value, or a pixel value.

$rem-base was deprecated in version 6.1, in favor of using $global-font-size to define rem calculation.


Colors

All interactive elements in Foundation, such as links and buttons, use the same color. The default shade of blue you see all over Foundation comes from the $primary-color Sass variable.

Many components can also be colored with four other colors: secondary, alert, success, and warning. Use these colors to give more context to UI elements and actions.

Primary

Secondary

Success

Warning

Alert

White

Light Gray

Medium Gray

Dark Gray

Black

If you're using the Sass version of Foundation, it's possible to edit the default color palette, by changing the $foundation-palette variable in your settings file. The only required color is one named "primary". The names used in the palette will be output as CSS classes.

$foundation-palette: (
  primary: #E44347,
  mars: #D7525C,
  saturn: #E4B884,
  neptune: #5147D7,
)

Using the above palette, we can add the .mars, .saturn, or .neptune classes to buttons, labels, badges, and more.

To access the colors in your code, use Sass's map-get() function:

.mars {
  color: map-get($foundation-palette, mars);
}

If you're upgrading an older version of Foundation 6 to 6.2, add the line @include add-foundation-colors; below the Global section of your settings file. This will allow legacy color variables, such as $primary-color and $secondary-color, to continue working.


Color Classes

Some components, such as buttons, callouts, and labels, have coloring classes, which let you change the color of the element by adding the name of the color as a CSS class.

<button class="button">Primary Action</button>
<button class="secondary button">Secondary Action</button>
<div class="success callout">
  <p>Created a new folder.</p>
</div>
<div class="alert callout">
  <p>Error fetching stick.</p>
</div>

Created a new folder.

Error fetching stick.


Sass Reference

Variables

The default styles of this component can be customized using these Sass variables in your project's settings file.

NameTypeDefault ValueDescription
$global-font-size Number 100%

Font size attribute applied to <html> and <body>. We use 100% by default so the value is inherited from the user's browser settings.

$global-width Number rem-calc(1200)

Global width of your site. Used by the grid to determine row width.

$global-lineheight Number 1.5

Default line height for all type. $global-lineheight is 24px while $global-font-size is 16px

$foundation-palette Map primary: #2199e8
secondary: #777
success: #3adb76
warning: #ffae00
alert: #ec5840

Colors used for buttons, callouts, links, etc. There must always be a color called primary.

$light-gray Color #e6e6e6

Color used for light gray UI items.

$medium-gray Color #cacaca

Color used for medium gray UI items.

$dark-gray Color #8a8a8a

Color used for dark gray UI items.

$black Color #0a0a0a

Color used for black ui items.

$white Color #fefefe

Color used for white ui items.

$body-background Color $white

Background color of the body.

$body-font-color Color $black

Text color of the body.

$body-font-family List 'Helvetica Neue', Helvetica, Roboto, Arial, sans-serif

Font stack of the body.

$body-antialiased Boolean true

Set to true to enable antialiased type, using the -webkit-font-smoothing and -moz-osx-font-smoothing CSS properties.

$global-margin Number 1rem

Global value used for margin on components.

$global-padding Number 1rem

Global value used for padding on components.

$global-weight-normal Keyword or Number normal

Global font weight used for normal type.

$global-weight-bold Keyword or Number bold

Global font weight used for bold type.

$global-radius Number 0

Global value used for all elements that have a border radius.

$global-text-direction Keyword ltr

Sets the text direction of the CSS. Can be either ltr or rtl.

$global-flexbox Boolean false

Enables flexbox for components that support it.

Stay on top of what’s happening in responsive design.

Sign up to receive monthly Responsive Reading highlights. Read Last Month's Edition »