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

HTML 参考手册

HTML 标签大全

HTML: <kbd> Tag

HTML <kbd>标签将文本定义为来自键盘的用户输入,例如Enter或Ctrl键。传统上,浏览器以默认的等宽字体呈现在 <kbd>标签中找到的文本。该标签通常也称为 <kbd>元素。

在线示例

在文档中格式化文本:

!doctype html>
<html>
<head>
<meta charset="UTF-8">
<title>HTML5 kbd标签的使用(基础教程网 oldtoolbag.com)</title>
</head>
<body>
<h1>键盘输入</h1>
<p>Press <kbd>Ctrl</kbd>+<kbd>C</kbd> to copy the text.</p>
</body>
</html>
测试看看 ‹/›


在此HTML5文档示例中,我们创建了<kbd>标签Ctrl+C用于表示键盘上的用户输入。默认情况下,您的浏览器将以默认的等宽字体显示此文本。您可以使用CSS覆盖此行为。

浏览器兼容性

IEFirefoxOperaChromeSafari

目前大多数浏览器支持 <kbd> 标签。

标签定义及使用说明

<kbd>  Tag defines keyboard text.

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

Tip:  The <kbd> tag is deprecated and not recommended for use, but can be implemented with rich effects using CSS.

All tag phrases:

TagsDescription
<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 was typed on a 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