For example, to close your browser hit Cmd + Q. Don't actually do it. There's more docs to read.
There are two ways to build keystrokes in Foundation 4: with our predefined HTML or with our mixins. Building keystrokes using our predefined classes is simple, you simply wrap kbd
or .keystroke
around whatever you want to call out.
For example, to close your browser hit Cmd + Q', :html %>
For these styles to come across, make sure you have the default Foundation CSS package or that you've selected keystrokes from a custom package. These should be linked up following our default HTML page structure.
We've included SCSS mixins used to style keystrokes. To use the mixin, you'll need to have the extension installed or grab _foundation-global.scss and _keystrokes.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/keystrokes"; ', :css %>You can build your keystrokes using our global mixin by including it on your custom class or the kbd
element in your own stylesheet. The mixin contains options for changing the background color, which also controls the border and text color. The rest of the defaults can be modified using the available variables. The global mixin looks like this:
Here's an example of a custom keystroke style.
Note: emCalc();
is a function we wrote to convert px
to em
. It is included in _foundation-global.scss.