document updated 13 years ago, on Jul 20, 2011
Officially
There are various tags that are normally used to present text in a monospace font:
- <pre> — indicates preformatted text
- <tt> — monospaced text
- <samp> — indicates sample output from a computer program
- <code> — indicates a piece of source code
- <kbd> — indicates text that the user is expected to type in
- <var> — indicates a variable name (or parameter, or keyword, or..)
How I use them
<kbd> should be styled differently, (especially on printouts) to indicate text that the user is expected to type in. If the user is skimming through a how-to document, the user should be able to quickly focus in on JUST the <kbd> sections, since often medium-experienced users can remember the concepts, but not remember exactly what to type.