<var> elementThe <var> element represents a variable. That variable might belong to mathematics, programming, science, logic, or ordinary prose where a symbol stands in for a value.
For example, in the expression x + 2, the letter x is not being used as an ordinary letter of the alphabet. It is a placeholder for a value. Marking it with <var> tells the document that the symbol is doing that kind of work.
The element is also useful for function parameters, constants, physical quantities, unknowns, and named placeholders. It identifies the role of the symbol in the text; it does not declare a program variable or calculate a value.
The <var> element should not be used just to make text italic. Browsers often display it in an italic style by default, but the meaning comes first. If the text is not a variable or placeholder, CSS or another element is usually a better choice.
For full mathematical notation, MathML is more precise. But for simple equations inside ordinary text, <var> is often enough, especially when the page is explaining a symbol rather than building a complete mathematical structure.
It can also be combined with <sub> or <sup> when a variable has a meaningful index or exponent. For example, x1 and x2 are not just decorated x's; they are different members of a family.
Attributes: GLOBALS.
Typical layout: <p> The square has area <var>x</var><sup>2</sup>. </p>
Visual representation:
Inline variable text, often italic by default.
The square has area x2.