Summary
The
HTML
<kbd>
Element
(or HTML Keyboard Input Element) represents user input and produces an inline element displayed in the browser's default monotype font.- Content categories: Flow content, phrasing content, palpable content.
- Permitted content: Phrasing content.
- Tag omission: None, both the starting and ending tag are mandatory.
- Permitted parent elements: Any element that accepts phrasing content.
- DOM interface:
HTMLElementUp to Gecko 1.9.2 (Firefox 4) inclusive, Firefox implements the interfaceHTMLSpanElementfor this element.
Attributes
Examples
<p>Type the following in the Run dialog: <kbd>cmd</kbd><br />Then click the OK button.</p>
<p>Save the document by pressing <kbd><kbd>Ctrl</kbd>+<kbd>S</kbd></kbd></p>
Result
Type the following in the Run dialog:
cmd
Then click the OK button.
Then click the OK button.
Save the document by pressing
Ctrl+S
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.Specifications
| Specification | Status | Comment |
|---|---|---|
| WHATWG HTML Living Standard | LSLiving Standard | |
| HTML5 | CRCandidate Recommendation | Expanded to include any user input, like voice input and individual keystrokes. |
| HTML 4.01 Specification | RECRecommendation |
Browser compatibility
| Feature | Chrome | Firefox (Gecko) | Internet Explorer | Opera | Safari |
|---|---|---|---|---|---|
| Basic support | (Yes) | 1.0 (1.7 or earlier) | (Yes) | (Yes) | (Yes) |
