% @side_nav = "css" %>
There are two ways to build pricing tables in Foundation 4: with our predefined HTML or with our mixins. Building pricing tables with our predefined classes is quite easy. You'll start with an <ul>
and add a class of .pricing-table
to it. From there, you just need to add list items inside that represent each piece of the table.
Available HTML class options for the list items:
<li class="title">
: Creates the styles for a title.<li class="price">
: Add a price that stands out.<li class="description">
: If you need to describe the plan, add this.<li class="bullet-item">
: To call out features, use this list item.<li class="cta-button">
: To add a button inside a list item, use this.For these styles to come across, make sure you have the default Foundation CSS package or that you've selected pricing-tables from a custom package. These should be linked up following our default HTML page structure.
We've included SCSS mixins used to style pricing tables so that you can code how you want to. To use the mixin, you'll need to have the extension installed or grab _foundation-global.scss, _global.scss and _pricing-tables.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/foundation-global", "foundation/components/global", "foundation/components/pricing-tables"; ', :css %>If you are using the mixins, you may include the styles on whatever class or ID you'd like with the <ul>
and the list items inside it.
Pricing tables are built up from an unordered list. We give this container some necessary styles by using our container mixin. There are no customizable options within the mixin, but everything can be changed using the SCSS variables below.
<%= code_example ' .your-pricing-class { @include pricing-table-container; .your-title-class { @include pricing-table-title; } .your-price-class { @include pricing-table-price; } .your-desc-class { @include pricing-table-description; } .your-bullet-class { @include pricing-table-bullet; } .your-cta-class { @include pricing-table-cta; } }', :css %>Note: emCalc();
is a function we wrote to convert px
to em
. It is included in _foundation-global.scss.