HTML <kbd> tag

The <kbd> tag is used to define keyboard input like shortcut, command prompt. The text within this element will display in the monospace font-family.

Type: Inline Element

Syntax of <kbd> tag

<kbd> Keyboard Input </kbd>

Supported Browsers

Tag Chrome Internet Explorer Firefox Safari Opera Mini
<kbd> Yes Yes Yes Yes Yes

Full code example

<!DOCTYPE html>
<html>
<head>
</head>
<body>
<!--Right Form-->
 <p> To undo last action, press <kbd> Ctrl + z </kbd>. </p>
<!--Wrong Form-->
 <p> To undo last action, press Ctrl + z. </p>
</body>
</html>
Run The code »

To undo last action, press Ctrl + z .

To undo last action, press Ctrl + z.

Difference between <kbd>, <code> and <samp> tag

Tag Note
<kbd> It defines user input.
<code> It defines computer code.
<samp> It shows program output.

<kbd> tag is a phrase tag. A phrase tag means a tag having semantical structure and meaning rather than just its apppearance.

Default CSS property of <kbd> tag
kbd {
  font-family: monospace;
}