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
  • 17
    +1 for adding this to the formatting help (rather than having needed Google to come up with this page). Commented Nov 30, 2011 at 17:36
  • 3
    I like, when question marked as duplicate has more votes, then original one :-D
    – Betlista
    Commented Jan 8, 2016 at 12:34
  • 8
    Oh wow, my question got closed as a duplicate ... seven years after asking it! I wonder if there's a badge for that? Commented Sep 8, 2017 at 6:00
  • Related: Castle building Commented Dec 9, 2019 at 23:32
  • related: meta.stackexchange.com/questions/36427/…
    – TT--
    Commented Oct 30, 2020 at 18:35

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
    Commented Dec 4, 2020 at 9:40
  • @IanVaughan use the "right arrow" :)) Commented Oct 24, 2021 at 7:00
  • 4
    Does this work in comments<kbd>Shift</kbd>+<kbd>/</kbd>
    – CivFan
    Commented 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 .