English | 简体中文 | 繁體中文 | Русский язык | Français | Español | Português | Deutsch | 日本語 | 한국어 | Italiano | بالعربية

HTML reference manual

HTML tag大全

HTML: <kbd> tag

The HTML <kbd> tag defines text as user input from the keyboard, such as Enter or Ctrl key. Traditionally, browsers display the text found in the <kbd> tag in the default monospaced font. This tag is also commonly referred to as the <kbd> element.

Online examples

Formatting text in the document:

!doctype html>
<html>
<head>
<meta charset="UTF-8">
<title>HTML5 Usage of <kbd> tag (Basic Tutorial Website oldtoolbag.com)</title>
</head>
<body>
<h1>keyboard input</h1>
<p>Press <kbd>Ctrl</kbd>+<kbd>C</kbd> to copy the text.</p>
</body>
</html>
Test to see ‹/›


In this HTML5In the document example, we created <kbd> tagsCtrl+CUsed to represent user input from the keyboard. By default, your browser will display this text in the default monospaced font. You can use CSS to override this behavior.

Browser compatibility

IEFirefoxOperaChromeSafari

Most web browsers support the <kbd> tag.

Label definition and usage instructions

<kbd>  tag defines keyboard text.

<kbd> tag is used to represent keyboard keys. Traditionally, browsers will format the text found in <kbd> tags as monospaced font. You can use CSS to change this behavior.

Tip:  The <kbd> tag is deprecated and not recommended for use, but are rich effects that can be achieved through CSS.

All tag phrases:

TagDescription
<em>Presented as emphasized text.
<strong>Define important text.
<dfn>Define a definition item.
<code>Define computer code text.
<samp>Define sample text.
<kbd>Define keyboard text. It indicates that the text is typed from the keyboard. It is often used in documents or manuals related to computers.
<var>Define variables. You can use this tag in conjunction with <pre> and <code> tags.

Global Attributes

<kbd> tag supports global attributes, see the complete attribute table HTML Global Attributes.

event attributes

<kbd> tag supports all HTML Event Attributes.

Related Articles

HTML Tutorial: HTML Text Formatting