kbd: The Keyboard Input element
The <kbd> HTML element represents a span of inline text denoting textual user input from a keyboard, voice input, or any other text entry device.
Attributes
Global attributes
accesskey Specifies a keyboard shortcut to activate or focus an element.
aria-* Defines accessibility properties and states for assistive technologies.
class Specifies one or more CSS class names for styling the element.
data-* Stores custom data private to the page or application.
dir Sets the text direction (left-to-right, right-to-left, or auto).
hidden Hides the element from display and assistive technologies.
id Defines a unique identifier for the element within the document.
inputmode Hints which virtual keyboard type to display on mobile devices.
itemid Provides a global identifier for microdata items.
itemprop Defines a property name-value pair for microdata.
itemref Associates properties with an item via element IDs for microdata.
itemscope Creates a new microdata item container.
itemtype Specifies the vocabulary URL for microdata items (like Schema.org).
lang Specifies the primary language of the element’s content.
nonce Provides a cryptographic nonce for Content Security Policy.
role Defines the element’s semantic role for accessibility.
tabindex Controls keyboard navigation order and focusability.
title Provides advisory information displayed as a tooltip.
Example
<p>To save your HTML file, press <kbd>Ctrl</kbd>+<kbd>S</kbd> (or <kbd>Cmd</kbd>+<kbd>S</kbd> on Mac).</p>
<p>Open your browser's developer tools with <kbd>F12</kbd> to inspect your website's HTML structure.</p>
<p>Navigate your terminal with <kbd>cd</kbd> to change directories, or use <kbd>ls</kbd> to list files in your project folder.</p>
<p>In Vim, press <kbd>i</kbd> to enter insert mode, then <kbd>Esc</kbd> and <kbd>:wq</kbd> to save and quit.</p>