HTML <kbd> Tag

Topic: HTML5 Tags ReferencePrev|Next


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


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 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.

Browsers Icon

Basic Support—

  • Firefox 1+
  • Google Chrome 1+
  • Internet Explorer 2+
  • Apple Safari 1+
  • Opera 4+

Further Reading

See tutorial on: HTML Text Formatting.

Related tag: <code>, <tt>.

Bootstrap UI Design Templates Property Marvels - A Leading Real Estate Portal for Premium Properties