What is the <kbd> element in HTML?

The <kbd> element in HTML can be used to display keyboard input.

Display

The text enclosed within <kbd> and </kbd> is displayed in the browser’s default monospace font.

Example

Use this tag to display “Ctrl+C” in the following way: Ctrl+C

Attributes

The <kbd> tag supports global attributesattributes common to all HTML elements (e.g., class, id, lang, title, etc.) and #key# event attributes: these are attributes connected to action events, e.g., mouse clicks, mouse movements, etc.

The <kbd> element can also be styled using CSS.

Code

The following example shows how the <kbd> tag is used.

Free Resources

Copyright ©2025 Educative, Inc. All rights reserved