5

How do I enter keystrokes in a pretty printed form?

For example, the keyboard combination CTRL-SHIFT-D in this answer was pretty printed as

keys

6
  • 2
    Must read <kbd> elements are way intrusive :P
    – Simon
    Commented Jan 19, 2012 at 13:08
  • A good reference for the implemented markdown and allowed inline html is Markdown help
    – Simon
    Commented Jan 19, 2012 at 13:12
  • That's the second link in my post. Commented Jan 19, 2012 at 13:13
  • You're right! I guess you just didn't get to the inline HTML section...
    – Simon
    Commented Jan 19, 2012 at 13:17
  • Indeed, thanks : ) Commented Jan 19, 2012 at 14:12
  • I rearranged your question a little in order to make it clean enough to be tagged faq - just like the corresponding question on meta.SO. I hope that is ok. (It makes a mess of the comments, but we can delete those!)
    – Simon
    Commented Jan 20, 2012 at 9:02

1 Answer 1

9

The html tag to produce the any key is

<kbd>any</kbd>

Just to clarify:
Stackexchange sites use an extended version of markdown and allows a certain subset of standard html tags. These tags work in questions, answers and tag wikis. Some stackexchange sites (including the Mathematica one) also allow for LaTeX via MathJax (you can thank the guys at mathoverflow for getting this working first).

The comments only allow a small subset of markdown and AFAIK none of the html tags. See the end of this meta.SO answer.

For examples of some more extreme uses of the allowed markdown, see the meta.SO sandbox

5
  • I have to try it: <kbd>test</kbd>. Commented Jan 19, 2012 at 15:36
  • It seems that it does not work on my end. Commented Jan 19, 2012 at 17:58
  • It might only work in an answer field?
    – Eli Lansey
    Commented Jan 19, 2012 at 20:56
  • 2
    @IstvánZachar: as noted in the recent edit of this answer, only a limited subset of markup works in comments.
    – Isaac
    Commented Jan 20, 2012 at 2:51
  • Thanks Isaac, I read it as well. Commented Jan 20, 2012 at 9:07

You must log in to answer this question.

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