HTML <kbd>
Tag
Topic: HTML5 Tags ReferencePrev|Next
Description
The <kbd>
(short for keyboard) tag specifies text as keyboard text. This tag indicates text to be entered by the user. Most browsers generally render the text enclosed by this element in a monospaced font, however you can overwrite its style with CSS. It differs from the <code>
tag which indicates code fragments, whereas <kbd>
tag indicates user input.
The following table summarizes the usages context and the version history of this tag.
Placement: | Inline |
---|---|
Content: | Inline and text |
Start/End Tag: | Start tag: required, End tag: required |
Version: | HTML 2, 3.2, 4, 4.01, 5 |
Syntax
The basic syntax of the <kbd>
tag is given with:
The example below shows the <kbd>
tag in action.
Example
Try this code »<p>Please, input "<kbd>Yes</kbd>" or "<kbd>No</kbd>"</p>
Tag-Specific Attributes
The <kbd>
tag doesn't have any specific attribute.
Global Attributes
Like all other HTML tags, the <kbd>
tag supports the global attributes in HTML5.
Event Attributes
The <kbd>
tag also supports the event attributes in HTML5.
Browser Compatibility
The <kbd>
tag is supported in all major modern browsers.
Basic Support—
|
Further Reading
See tutorial on: HTML Text Formatting.