HTML <kbd> tag

Updated: 11/30/2020 by Computer Hope
HTML kbd tag

When writing in HTML (hypertext markup language), the <kbd> tag is an inline element used to designate that a section of text is keyboard input. The following sections contain information about this tag, including an example of it in use, and related attributes, browser compatibility.

Note

This element is unique in that it is a phrase tag, which indicates that a section of text has structural meaning.

Example of <kbd> code

<p>Press the <kbd>Ctrl</kbd>+<kbd>C</kbd> keys to copy highlighted text.</p>

Example result

Press the Ctrl+C keys to copy highlighted text.

By default, text contained in the kbd tag uses a monospace font given to it from the browser. However, adding CSS (cascading style sheets) settings as we've done above gives the tag's text an even better appearance.

Attributes

All HTML tags support standard attributes that define the settings of an HTML element. Unlike other HTML tags, the <kbd> tag has no unique attributes.

Compatibility

Edge Internet Explorer Firefox Safari Opera Chrome
All versions All versions All versions All version All versions All versions

Additional phrase tags

Browser, Compatibility, Container tag, Input, Keyboard, Web design terms