<var> HTML Tag

Element of
Fonts and Web Typography
What does <var> HTML Tag do?
The <var> element is used to identify a variable in a mathematical equation or computer program. Text marked with <var> tags is displayed in an italics font style by most browsers.
Display
inline
Usage
semantic

Code Example

<p>The equation for any straight line can be expressed in the formula: 
<var>y</var> = <var>mx</var> + <var>b</var>.</p>

The equation for any straight line can be expressed in the formula: y = mx + b.

When to use <var>

The <var> element is used to identify a variable. There are at least three scenarios where use of this element is appropriate:

  • To wrap variables in a mathematic equation, as shown in the code sample above.
  • To identify variables in a snippet of computer programming code.
  • To identify variables used in paragraph text or prose.

The first two scenarios are pretty self-explanatory, the third scenario might look something like this:

If we consume n cookies on average, every day, will need to exercise y more minutes every day to burn off those extra calories.

This is the mysterious user account for the HTML.com admin.