HTML kbd Tag

HTML <kbd> tag stands for the Keyboard Input element. This tag is used to enclose any text which represents a keyboard input.

  • The <kbd> tag comes under the category of Phrase tag.

  • Also, this is an Inline element.

  • <kbd> tag represents a span of inline text which denotes input in the form of text from the keyboard, voice input or any other text entry by the keyboard. So if you have to write any keyboard command anywhere on your webpage, for example to paste text press CTRL + V, then CTRL and V are keyboard inputs and should be included in the <kbd> tag.

  • Whenever one <kbd> tag is nested with another <kbd> tag then it represents an actual key.

  • Whenever a <kbd> is nested inside a <samp> tag then it represents that input has been responded to the user by the system.

HTML <kbd> Tag - Syntax and Usage

The <kbd> tag requires the start(opening) tag and end(closing) tag.

The required syntax for the same is given below:

<kbd>
    content goes here
</kbd>

HTML <kbd> Tag Basic Example

Below we have a basic example where we have used the <kbd> tag wherever we have mentioned the Keyboard keys in text on our webpage.

Now, we will show you how to use <kbd> tag inside <samp> tag. Whenever <kbd> tagis nested inside the <samp> tag, it represents that the input is responded back to the user by the system:

HTML <kbd> Tag Attributes

This element does not have any specific attributes although this element supports Global attributes and Event attributes.

Default CSS Settings for HTML <kbd> Tag

The default CSS Settings or value for <kbd> tag is as shown below:

kbd {
    font-family: monospace;
}

Browser Support for HTML5 <kbd> tag

Following browsers support this attribute:

  • Firefox 1+

  • Google Chrome 1+

  • Internet Explorer 2+

  • Apple Safari 1+

  • Opera 4+