I like how tags are cleverly displayed in gray boxes in this question, among others: https://meta.stackexchange.com/questions/6119/retag-request-opensource-open-source

What's the markdown syntax for this?


That would be the <kbd> tag:

<kbd>hello, world</kbd>


hello, world

It's used mainly to demonstrate keys that the reader is supposed to press, like ctrl+t, etc.

Though <kbd> is an HTML tag, StackOverflow applies some CSS to make it look like a real button:

kbd {
  background:#EEEEEE none repeat scroll 0 0;
  border-color:#CCCCCC #AAAAAA #888888 #BBBBBB;
  border-width:1px 3px 3px 1px;
  padding:2px 4px;
  • Ah, thanks. So this is just standard HTML, not markdown? Any special CSS required to format it like the real tag rectangles? Jul 21 '09 at 3:44
  • Yes, and I've updated my answer to include it Jul 21 '09 at 3:58
  • Coolness . Jul 21 '09 at 4:17
  • This should be added to the "Formatting reference"
    – TM.
    Jul 27 '09 at 6:16
  • 1
    Cool, I think I may have to copy and paste that into my personal CSS for help pages, I can see this making a real difference to users when suggesting they press a specified button.
    – DaveM
    Jun 29 '12 at 8:51

Note that, if talking about actual tags, it's better to use the new [meta-tag:tags] -> syntax; see Is there some markup to post tags? or the formatting help for details.


Fun with <kdb> tags: <kbd> elements are way intrusive

You must log in to answer this question.

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