The <kbd>
tag marks text that represent a keyboard shortcut.
This tag can also be used for voice input or any other text input device.
By default, the text content is displayed using a monospace font.
This <kbd>
tag marks a CTRL+C keyboard command.
<kbd>CTRL + C</kbd> is used to copy content.
kbd
= keyboard
Three styled <kbd>
elements with keyboard shortcuts.
<style>
kbd.k {
padding: 0.2rem 0.4rem;
font-size: 87.5%;
color: #fff;
background-color: #212529;
border-radius: 0.2rem;
}
</style>
<kbd class="k">CTRL + X</kbd> is used to cut content.<br />
<kbd class="k">CTRL + C</kbd> is used to copy content.<br />
<kbd class="k">CTRL + V</kbd> is used to paste content.
The <kbd>
element has no attributes, but it does accept global attributes.
The following are commonly used.
Attribute | Value | Description |
---|---|---|
id | value | Provides the kbd element with a unique identifier. |
class | classnames | Assigns one or more classnames to the kbd element. |
style | CSS-values | Assigns CSS style values to the kbd element. |
For additional global attributes see our global attributes list.
Phrase tags highlight the meaning of a small piece of text (i.e. a phrase).
The <kbd>
tag is one of them, but there several others.
A list of all HTML Phrase tags.
Tag | Description |
---|---|
<em> | Indicates emphasized text |
<strong> | Indicates important text |
<code> | Indicates computer code |
<samp> | Indicates sample output from a computer program |
<kbd> | Indicates keyboard input |
<var> | Indicates a variable |
The <kbd>
tag is part of a group of tags
that are used to create and format text documents.
This group is referred to as the Text tag group.
Together, they allow you to create comprehensive HTML text documents.
Here is a list of text tags.
Element | Description |
---|---|
<h1>-<h6> | Defines text headings in 6 different sizes |
<p> | Creates a paragraph |
<span> | Container for one or more inline text elements |
<br> | Creates a line break |
<sup> | Specifies superscript text |
<sub> | Specifies subscripted text |
<u> | Specifies underlined text |
<i> | Specifies italic text |
<b> | Specifies bold text |
<em> | Marks text that needs emphasis |
<strong> | Indicates text that is important or with high urgency |
<del> | Defines deleted text |
<ins> | Defines inserted text |
<ruby> | Represents a small annotation with pronunciation of text |
<kbd> | Specifies keyboard input, such as, CTRL or ALT |
<wbr> | Specifies a preferred word-break location for long words |
Here is when <kbd>
support started for each browser:
Chrome
|
1.0 | Sep 2008 |
Firefox
|
1.0 | Sep 2002 |
IE/Edge
|
1.0 | Aug 1995 |
Opera
|
1.0 | Jan 2006 |
Safari
|
1.0 | Jan 2003 |