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.
Name | Type | Default Value | Description |
---|---|---|---|
$global-font-size |
Number | 100% |
Font size attribute applied to |
$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. |
$foundation-palette |
Map |
primary: #2199e8 |
Colors used for buttons, callouts, links, etc. There must always be a color called |
$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 |
$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 |
$global-flexbox |
Boolean | false |
Enables flexbox for components that support it. |