% @side_nav = "css" %>
It has an easy to override visual style, and is appropriately subdued.
It's a little ostentatious, but useful for important content.
There are two ways to build panels in Foundation 4, either with our predefined HTML or with our mixin. Building panels using our predefined class isn't hard at all. You'll start with <div>
and add a class of .panel
to it. From there, you just need to add content inside, anything will do.
Available HTML class options:
.callout
to your panel will make it our default blue and add a shiny top edge to help it stand out..radius
to add a tasteful border-radius to thie mix.For these styles to come across, make sure you have the default Foundation CSS package or that you've selected panels from a custom package. These should be linked up following our default HTML page structure.
We've included SCSS mixins used to style panels so that you can code smarter. To use the mixin, you'll need to have the extension installed or grab _foundation-global.scss, _global.scss and _panels.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/panels"; ', :css %>If you are using the mixins, you may include the styles on whatever class or ID you'd like to the <div>
.
You can build your panel using our global mixin by including it on your own custom class or ID. The mixin contains all the necessary styles and they can be customized a bit within the mixin. The rest of the important styles are controlled by variables. The code looks like this:
<%= code_example ' .your-class-name { @include panel; }', :css %>You also have two options available to customize the panel within the mixin. These control the background color (which also effect border and font color) and the interior padding of the panel itself.
<%= code_example ' .your-class-name { @include panel($bg, $padding); } /* This controls the background color, border color and type color based on brightness of the bg. */ $bg: $secondary-color /* This controls the interior padding */ $padding: $panel-padding ', :css %>Note: emCalc();
is a function we wrote to convert px
to em
. It is included in _foundation-global.scss.