% @side_nav = "nav" %>
There are two ways to build breadcrumbs in Foundation 4: with our predefined HTML classes or with our structure and mixins. Building breadcrumbs using our predefined class is easy. You'll need an <ul class="breadcrumbs">
with <li>
elements inside. You have access to two state classes: <li class="unavailable">
and <li class="current">
to control link intentions. The default markup looks like this:
For these styles to come across, make sure you have the default Foundation CSS package or that you've selected breadcrumbs from a custom package. These should be linked up following our default HTML page structure.
We've included SCSS mixins used to style breadcrumbs. To use these mixins, you'll need to have the extension installed or grab _variables.scss, _global.scss and _breadcrumbs.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:
<%= code_example ' @import "foundation/variables"; @import "foundation/components/global"; @import "foundation/components/breadcrumbs"; ', :css %>If you are using the mixins, you may include the styles on whatever class or ID you'd like, just make sure you follow our markup structure:
<%= code_example ' ', :html %>You can build your breadcrumbs using our global mixin by including it on your custom class or ID in your stylesheet. The container mixin will create the necessary style for the <ul>
. The global mixin looks like this:
Use this mixin to apply the list item and link styles to items inside the breadcrumb container. You attach this mixin to the list items inside of your container.
<%= code_example ' .your-class-name { @include crumb-container; li { @include crumbs; } } ', :css %>We've also created a global radius mixin that you can use to add border-radius to any element you'd like.
<%= code_example ' .your-class-name { @include crumb-container; @include radius($radius); li { @include crumbs; } } ', :css %>Note: em-calc();
is a function we wrote to convert px
to em
.