Skip to: content, navigation

by Ian Lloyd

kbd (HTML element)

Spec
Depr. Empty Version
No No HTML 2
Browser support full matrix
IE5.5+ FF1+ Saf1.3+ Op9.2+
Full Full Full Full
<kbd>
</kbd>

Example

A support site that provides instructions to help Windows users to unfreeze an application might include the following HTML:

<p>Hold down <kbd>CTRL</kbd>, <kbd>ALT</kbd>, and <kbd>DELETE</kbd>,
    then select Task Manager</p>
Type
inline element
Contains
inline elements only
Contained by
block-level elements, inline elements

Description

The kbd element is used to identify keystrokes that the user needs to make on his or her keyboard. These keystrokes could form a string of text, or they could reflect individual key presses that the user must complete (for example, pressing Enter or Backspace). It’s most likely to be found in online technical manuals or support sites.

Most browsers will render kbd content in a monospace font, but it’s possible to style its display with CSS (for example, setting a background color and a border to make the character appear a little more like a key on a keyboard).

The example HTML above would render as shown in Figure 1.

Figure 1. The browser displays the kbd element as monospaced Example of kbd element

Use This For …

This element is used to identify individual key presses, complete words that must be typed, or buttons that should be pressed on a keypad.

Compatibility

IE5.5Full
6.0Full
7.0Full
Firefox1.0Full
1.5Full
2.0Full
Safari1.3Full
2.0Full
3.0Full
Opera9.2Full
9.5Full

The kbd has good browser support; most major browsers render it in a fixed-width font.

User-contributed notes

There are no comments yet.

Add a note

To post a note on this topic, please log in with your SitePoint username and password. If you don't have an account yet, you can create a new account for free.

Related Products

The Principles of Beautiful Web Design

Best Seller!

You don’t need to go to Art School to design great looking web sites!

Book Cover: The Principles of Beautiful Web Design

Download the FREE sample chapters