7

I've seen that the <kbd> element is used in a lot of questions and is used to reference a tag. But I've also seen questions that use [tag:tagname] for the same purpose. They look a little bit different (sometag vs ), but they seem to be used for the same purpose.

When should I use each of these?

17

Use <kbd> for keyboard keys. Caps Lock, Shift, Esc, C

Use [tag:tagname] for tags. ,

Use [meta-tag:tagname] for Meta tags.

Use backticks for inline code. foo.bar(0);

If you see a post where keyboard keys have been expressed using tag syntax, edit it to use <kbd> notation. Not only is it good style and consistent, it helps users who may not understand what you are talking about or who are using assistive technology.

In certain contexts, there can be true confusion. Did you mean to talk about - related questions or about the meta key on the Space Cadet Keyboard or in Emacs?

Don't use something for something it's not intended for unless there is no other way to do it or you have a very good reason.

  • 8
    Another reason not to mix them up is that the [tag:tagname] markup actually links to the "Questions tagged [tagname]" page... which makes no sense if you meant to use a <kbd> element. – Robert Cartaino Nov 27 '18 at 2:33

You must log in to answer this question.

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