Skip to content

<var> - The Variable Element

Inline HTML 2.0

The variable element represents a variable in a mathematical expression, programming context, or any placeholder value. It’s typically rendered in italic.

Result
<var>variable name</var>

The <var> element marks text that represents a variable or placeholder.

Result
Result
Result
Result
Result
Result
<!-- Variables in math/programming -->
<p>Let <var>x</var> = 5</p>
Result
Result
Result
Result

Customize variable appearance:

Result
Result
Result
Result
Result
<p>This is <var>very</var> important.</p>
<p>Use the <var>console.log()</var> function.</p>

Screen readers typically read <var> content as regular text. The italic styling is visual only.

Make sure variable purpose is clear:

<p>Set <var>x</var> to the value.</p>

For complex math, provide alternative descriptions:

<p>
<span aria-label="E equals M C squared">
<var>E</var> = <var>m</var><var>c</var><sup>2</sup>
</span>
</p>
Result
Result
BrowserVersionNotes
Chrome1+Full support
Firefox1+Full support
Safari1+Full support
Edge12+Full support
IE3+Full support

The <var> element has been supported since the earliest browsers.