The (X)HTML <var> Element

What is the correct use of the <var> element type?

<var> is used to mark up a variable, or replaceable, part of some text. It's a typographic convention to italicise such variables, which will be replaced by actual data in real life. For instance, in a telephone system manual, the instruction for relaying incoming calls to another extension could look something like this:

<kbd>* 21 * <var> extension </var> #</kbd>

Here, a <var> element is used to mark up "extension" (which will be italic by default). Someone trying to program the telephone system to relay his incoming calls to extension 942 would type "*21*942#". Thus the <var> element indicates that you shouldn't actually type "e-x-t-e-n-s-i-o-n", but enter the actual extension number instead. The word "extension" is a variable.

A common misconception is that <var> should be used for marking up variables in programming code samples.