Warning:
This wiki has been archived and is now read-only.

Elements/var

From HTML Wiki
Jump to: navigation, search

<var>

The <var> element represents a variable.

Point

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


HTML Attributes

See global attributes.


Examples

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]:

<figure>
 <math>
  <mi>a</mi>
  <mo>=</mo>
  <msqrt>
   <msup><mi>b</mi><mn>2</mn></msup>
   <mi>+</mi>
   <msup><mi>c</mi><mn>2</mn></msup>
  </msqrt>
 </math>
 <figcaption>
  Using Pythagoras' theorem to solve for the hypotenuse <var>a</var> of
  a triangle with sides <var>b</var> and <var>c</var>
 </figcaption>
</figure>


HTML Reference

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