Side Nav

Side nav, like you'll see on Foundation's main site, is useful for sections of either a site or a page.

Build With Predefined HTML Classes

There are two ways to build a side nav in Foundation 4: either with our predefined HTML classes or our mixins. Building side nav using our predefined classes is simple, you'll just need to write a <ul class="side-nav"> and fill it full of list items. The width of the side nav is controlled by the columns you put it inside.

The list item options:

  • active Will add style to denote the active link.
  • divider Creates a divider between list items.
<ul class="side-nav">
  <li class="active"><a href="#">Link 1</a></li>
  <li><a href="#">Link 2</a></li>
  <li class="divider"></li>
  <li><a href="#">Link 3</a></li>
  <li><a href="#">Link 4</a></li>

For these styles to come across, make sure you have the default Foundation CSS package or that you've selected side nav from a custom package. These should be linked up following our default HTML page structure.

Build with our Mixins

We've included SCSS mixins used to style side nav. To use the mixin, you'll need to have the extension installed or grab _variables.scss, _global.scss and _side-nav.scss from Github and throw them into a Foundation folder in your project directory. From there, you can import the files at the top of your own SCSS stylesheet, like so:

@import "foundation/variables";
@import "foundation/components/global";
@import "foundation/components/side-nav";
Quick Mixin

You can build your side nav using our global mixin by including it on a custom class or ID in your own stylesheet. The mixin contains options for changing the background color, which also controls the border and text color. You'll also have the ability to change the font-size and padding. The rest of the defaults can be modified using the available variables. The global mixin looks like this:

/* Using the default styles */
.your-class-name { @include side-nav; }

There are also three options you can customize on the fly when writing this mixin. These controls things like: divider color, text size and font color.

/* Using the available options */
.your-class-name { @include side-nav($divider-color, $font-size, $link-color); }

/* Control the color of the divider between links */
$divider-color: $side-nav-divider-color

/* Control your font-size per label */
$font-size: $side-nav-font-size

/* Change the background color for your labels */
$link-color: $side-nav-link-color
Default SCSS Variables
$include-html-nav-classes: $include-html-classes;

/* We use this to control padding. */
$side-nav-padding: em-calc(14 0);

/* We use these to control list styles. */
$side-nav-list-type: none;
$side-nav-list-position: inside;
$side-nav-list-margin: em-calc(0 0 7 0);

/* We use these to control link styles. */
$side-nav-link-color: $primary-color;
$side-nav-link-color-active: lighten(#000, 30%);
$side-nav-font-size: em-calc(14);
$side-nav-font-weight: bold;

/* We use these to control border styles */
$side-nav-divider-size: 1px;
$side-nav-divider-style: solid;
$side-nav-divider-color: darken(#fff, 10%);

Note: em-calc(); is a function we wrote to convert px to em. It is included in _variables.scss.

This is a modal.

Reveal makes these very easy to summon and dismiss. The close button is simply an anchor with a unicode character icon and a class of close-reveal-modal. Clicking anywhere outside the modal will also dismiss it.

Finally, if your modal summons another Reveal modal, the plugin will handle that for you gracefully.

Second Modal...


This is a second modal.

See? It just slides into place after the other first modal. Very handy when you need subsequent dialogs, or when a modal option impacts or requires another decision.


This modal has video