From W3C Wiki
< HTML‎ | Elements
Revision as of 15:00, 22 July 2011 by Plehegar (Talk | contribs)

(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to: navigation, search


The <var> element represents a variable.


  • This element could be an actual variable in a mathematical expression or programming context.

HTML Attributes

See global attributes.


Example A

In the paragraph below, the letter "n" is being used as a variable in prose [try it]:

<p>If there are <var>n</var> pipes leading to the ice
cream factory then I expect at <em>least</em> <var>n</var>
flavors of ice cream to be available for purchase!</p>


Example B

In this example, an equation is shown, with a legend that references the variables in the equation. The expression itself is marked up with MathML, but the variables are mentioned in the figure's legend using a var element [try it]:

  Using Pythagoras' theorem to solve for the hypotenuse <var>a</var> of
  a triangle with sides <var>b</var> and <var>c</var>


HTML Reference

The HTML5 specification defines the <var> element in 4.6.12 The var element.