HTML keyboard input - how to use <kbd> tag

The HTML <kbd> tag is a phrase tag used to define keyboard input. Most browser display keyboard input in monospace font.

Attributes

The kbd tag supports the global and event attributes.

Examples:

<p>some text</p> <section> <h3>Text from keyboard</h3> <kbd>var i = 10;</kbd> </section>

Related HTML tags:

  • <code> - used to display computer code
  • <samp> - used to display sample output from a computer program
  • <var> - used to display a variable