<var>

  • Revision slug: HTML/Element/var
  • Revision title: var
  • Revision id: 306999
  • Created:
  • Creator: ethertank
  • Is current revision? No
  • Comment

Revision Content

Summary

The HTML Variable Element (<var>) represents a variable in a mathematical expression or a programming context.

Usage Context

Permitted content Phrasing content
Tag omission Both start and end tags are required
Permitted parent elements Any element that accepts phrasing content.
Normative document HTML, "The var element"

Attributes

Global attributes only.

DOM Interface

This element implements the HTMLElement interface.

Implementation note: up to Gecko 1.9.2 inclusive, Firefox implements the HTMLSpanElement interface for this element.

Typical default style properties

var {
  font-style: italic; 
}

Example

<p> A simple equation: <var>x</var> = <var>y</var> + 2 </p>

A simple equation: x = y + 2

{{ HTML:Element_Navigation() }}

Revision Source

<h2 id="Summary">Summary</h2>
<p>The HTML Variable Element (<code>&lt;var&gt;</code>) represents a variable in a mathematical expression or a programming context.</p>



<h2 id="Usage_Context">Usage Context</h2>
<table class="standard-table">
  <tbody>
    <tr>
      <td>Permitted content</td>
      <td>Phrasing content</td>
    </tr>
    <tr>
      <td>Tag omission</td>
      <td>Both start and end tags are required</td>
    </tr>
    <tr>
      <td>Permitted parent elements</td>
      <td>Any element that accepts <a href="/en/HTML/Content_categories#phrasing_content" title="en/HTML/Content categories#phrasing content">phrasing content</a>.</td>
    </tr>
    <tr>
      <td>Normative document</td>
      <td><a class="external" href="http://www.whatwg.org/html/#the-var-element">HTML, "The <code>var</code> element"</a></td>
    </tr>
  </tbody>
</table>



<h2 id="Attributes">Attributes</h2>
<p>Global attributes only.</p>


<h3 class="editable" id="DOM_Interface">DOM Interface</h3>
<p>This element implements the <code><a href="/en/DOM/element" title="en/DOM/element">HTMLElement</a></code> interface.</p>
<div class="note">
  <p><strong>Implementation note: </strong>up to Gecko 1.9.2 inclusive, Firefox implements the <a href="/en/DOM/span" title="en/DOM/span"><span style="font-family: Courier New;">HTMLSpanElement</span></a> interface for this element.</p>
</div>



<h3 id="Typical_default_style_properties">Typical default style properties</h3>
<pre class="brush:css">
var {
  font-style: italic; 
}
</pre>



<h3 id="Example">Example</h3>
<pre class="brush:html">
&lt;p&gt; A simple equation: &lt;var&gt;x&lt;/var&gt; = &lt;var&gt;y&lt;/var&gt; + 2 &lt;/p&gt;
</pre>
<p>A simple equation: <var>x</var> = <var>y</var> + 2</p>



<div>{{ HTML:Element_Navigation() }}</div>
Revert to this revision