Summary
The HTML <kbd>
Element (or HTML Keyboard Input Element) represents user input and produces an inline element displayed in the browser's default monospace font.
- Content categories Flow content, phrasing content, palpable content.
- Permitted content Phrasing content.
- Tag omission {{no_tag_omission}}
- Permitted parent elements Any element that accepts phrasing content.
- DOM interface {{domxref("HTMLElement")}} Up to Gecko 1.9.2 (Firefox 4) inclusive, Firefox implements the interface {{domxref("HTMLSpanElement")}} for this element.
Attributes
This element only includes the global 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.
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 |
---|---|---|
{{SpecName('HTML WHATWG', 'text-level-semantics.html#the-kbd-element', '<kbd>')}} | {{Spec2('HTML WHATWG')}} | |
{{SpecName('HTML5 W3C', 'text-level-semantics.html#the-kbd-element', '<kbd>')}} | {{Spec2('HTML5 W3C')}} | Expanded to include any user input, like voice input and individual keystrokes. |
{{SpecName('HTML4.01', 'struct/text.html#h-9.2.1', '<kbd>')}} | {{Spec2('HTML4.01')}} |
Browser compatibility
{{CompatibilityTable}}
Feature | Chrome | Firefox (Gecko) | Internet Explorer | Opera | Safari |
---|---|---|---|---|---|
Basic support | {{CompatVersionUnknown}} | {{CompatGeckoDesktop("1.0")}} | {{CompatVersionUnknown}} | {{CompatVersionUnknown}} | {{CompatVersionUnknown}} |
Feature | Android | Firefox Mobile (Gecko) | IE Mobile | Opera Mobile | Safari Mobile |
---|---|---|---|---|---|
Basic support | {{CompatVersionUnknown}} | {{CompatGeckoMobile("1.0")}} | {{CompatVersionUnknown}} | {{CompatVersionUnknown}} | {{CompatVersionUnknown}} |
See also
- {{htmlelement("code")}}
{{HTMLRef}}