# Distinguish keyboard shortcuts from commands in HTML

Canonical: https://githtml.com/guides/keyboard-shortcuts-kbd-html
Published: 2026-11-23
Publisher: WaveTech LLC / gitHtml

Mark keyboard input with kbd and describe whether keys are pressed together or in sequence. Keep commands, output, and physical keys visually and verbally distinct. A shortcut printed in a document is an instruction, not an interactive control, so it should not look like a tappable button on a phone.

## Choose the right representation

A manual can contain three different things in one sentence: the name of a key, a command to enter, and a response to expect. Styling all three as generic monospace text makes readers work harder. Use kbd for input and ordinary explanatory words for the timing relationship. Explicitly say when a hardware keyboard is required.

## Apply the pattern deliberately

Write Command plus K in prose before relying on the familiar symbol shorthand. For sequential shortcuts, say release the first key before pressing the next rather than using an ambiguous plus sign. Small keycap borders can help scanning, but keep the text selectable and avoid adding click handlers to what is only a typographic example.

1. Label the platform and application context before presenting the first shortcut example.
2. Use separate kbd elements for separate keys and words to explain their relationship.
3. Provide a non-keyboard route when the documented task has an equivalent visible control.

````html
<p>With a hardware keyboard, hold <kbd>Command</kbd> and press <kbd>K</kbd>.</p>
````

## Prevent shortcut instructions from becoming ambiguous

Consider two fictional instructions: hold Control and press K, versus press G, release it, then press D. The first is a chord; the second is a sequence. A compact label such as G+D can make the second look like the first. Put the timing in the sentence and use individual key labels only as supporting typography. Include whether the application must have focus or a particular panel must be open before the shortcut works.

Keep platform variants together with their conditions. A Mac label and a Windows label should not be combined into a mysterious Control/Command expression when the application assigns them different behavior. If you have verified both variants, label them separately. If only one has been checked, say which one. A browser, operating system, remote desktop session, or assistive tool may intercept a shortcut before it reaches the application, so a failed shortcut does not automatically mean the key names are wrong.

For touch readers, describe the corresponding menu item or button when one exists. Do not invent an equivalent if the feature requires a physical keyboard. A useful final exercise is to read the instruction with all keycap styling removed: the person should still know what to hold, what to press, what to release, and where the action happens. This catches omissions that attractive little keyboard boxes can otherwise conceal.

## Check the finished reading experience

A useful review pairs a chord with a sequence and asks a new reader to explain the difference. If both examples are interpreted as simultaneous presses, revise the wording. Verify platform labels against the application being documented instead of assuming desktop and tablet shortcuts match.

## Sources and further reading

- [MDN: kbd](https://developer.mozilla.org/en-US/docs/Web/HTML/Reference/Elements/kbd)

## Related guides

- [Move a reading task between iPhone and iPad without losing context](https://githtml.com/guides/move-reading-between-iphone-ipad-without-losing-context)
- [Read technical HTML comfortably on iPad in portrait and landscape](https://githtml.com/guides/read-technical-html-ipad-portrait-landscape)
- [Build a small GitHub document reading queue with favorites and recents](https://githtml.com/guides/favorites-recents-document-reading-queue)
- [Find answers in long HTML reports with better search queries](https://githtml.com/guides/search-long-html-report-with-better-queries)

Editorial approach: https://githtml.com/guides/about
