HTML/Elements/kbd

From Web Education Community Group
< HTML‎ | Elements
Jump to: navigation, search

<kbd>

The <kbd> element represents user input.

Point

  • Example of user input:
    • keyboard input
    • voice commands ...
  • When the kbd element is nested inside a samp element, it represents the input as it was echoed by the system.
  • When the kbd element contains a samp element, it represents input based on system output, for example invoking a menu item.
  • When the kbd element is nested inside another kbd element, it represents an actual key or other single unit of input as appropriate for the input mechanism. [Example B]


HTML Attributes

See global attributes.


Examples

Example A

[try it]

<p>Please, input "<kbd>Yes</kbd>" or "<kbd>No</kbd>"</p>

Kbd01.png

Example B

Represents an actual key [try it]:

<p>Please, press <kbd><kbd>Shift</kbd>+<kbd>A</kbd></kbd></p>

Kbd02.png

HTML Reference

The HTML5 specification defines the <kbd> element in 4.6.14 The kbd element.