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:

HTML/XHTML: <kbd> ... </kbd>

The example below shows the <kbd> tag in action.

<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 glodelal Attributes in HTML5.

Event Attributes

The <kbd> tag also supports the event Attributes in HTML5.

Browser Compatibility

Element
<i>YesYesYesYesYes