483

Some answers contain characters that look like keyboard keys. They look like

Ctrl + E

What markup do I need to add to make Ctrl and E look like actual keys?
That's not mentioned in the formatting help.

5

2 Answers 2

531

Use the <kbd> tag. For example, write <kbd>Shift</kbd>+<kbd>Enter</kbd> for it to display as Shift+Enter.

After this answer was accepted, the <kbd> tag was disabled on Meta. It then still worked on SO, SF and SU. Meanwhile it has been enabled on Meta again as well.

3
  • Is there a correct word to use for arrow keys? eg Right or Right arrow or ?
    – IanVaughan
    Dec 4, 2020 at 9:40
  • @IanVaughan use the "right arrow" :)) Oct 24, 2021 at 7:00
  • 3
    Does this work in comments<kbd>Shift</kbd>+<kbd>/</kbd>
    – CivFan
    Aug 17, 2022 at 16:40
78

Use the kbd tag:

<kbd>Ctrl</kbd>+<kbd>E</kbd>

The rendered output would look like this:

Ctrl+E

0

Not the answer you're looking for? Browse other questions tagged .