Summary
The HTML Keyboard Input Element (<kbd>) produces an inline element displayed in the browser's default monotype font. This element is used to identify user input.
Usage context
| Permitted content | Flow content or phrasing content. |
| Tag omission | None, must have both a start tag and an end tag |
| Permitted parent elements | Phrasing content |
| Normative document | HTML 5, section 4.6.14; HTML 4.01, section 9.2.1 |
Attributes
This element has no other attributes than the global attributes, common to all elements.
DOM Interface
This element implements the HTMLElement interface.
Implementation note: up to Gecko 1.9.2 inclusive, Firefox implements the HTMLSpanElement interface for this element.
Example
<p>Type the following in the Run dialog: <kbd>cmd</kbd><br />Then click the OK button.</p>
Result
Type the following in the Run dialog: cmd
Then click the OK button.
Note
A CSS rule can be defined for the kbd selector to override the browser's default font face. Preferences set by the user might take precedence over the specified CSS.
See also
- HTML Code Element
- HTML4 Specification: Phrase Elements
- HTML5 Specification: The
kbdelement


Mozilla Developer Network