<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.
|Content:||Inline and text|
|Start/End Tag:||Start tag: required, End tag: required|
|Version:||HTML 2, 3.2, 4, 4.01, 5|
The basic syntax of the
<kbd> tag is given with:
The example below shows the
<kbd> tag in action.
ExampleTry this code »
<p>Please, input "<kbd>Yes</kbd>" or "<kbd>No</kbd>"</p>
<kbd> tag doesn't have any specific attribute.
Like all other HTML tags, the
<kbd> tag supports the global attributes in HTML5.
<kbd> tag also supports the event attributes in HTML5.
<kbd> tag is supported in all major modern browsers.
See tutorial on: HTML Text Formatting.