<var> (Variable)
This element is used to indicate a variable. Variables are identifiers that occur in a programming language or a mathematical expression. The element is logical, although enclosed text often is rendered in italics.
Standard Syntax
<var
class="class name(s)"</var>
dir="ltr | rtl"
id="unique alphanumeric value"
lang="language code"
style="style information"
title="advisory text"
Attributes Defined by Internet Explorer
accesskey="key" (5.5)
contenteditable="false | true | inherit" (5.5)
hidefocus="true | false" (5.5)
language="javascript | jscript | vbs | vbscript" (4)
tabindex="number" (5.5)
unselectable="on | off" (5.5)
Standard Event Attributes
onclick, ondblclick, onkeydown, onkeypress, onkeyup, onmousedown, onmousemove, onmouseout, onmouseover, onmouseup
Events Defined by Internet Explorer
onactivate, onbeforeactivate, onbeforecopy, onbeforecut, onbeforedeactivate, onbeforeeditfocus, onbeforepaste, onblur, oncontextmenu, oncontrolselect, oncopy, oncut, ondeactivate, ondrag, ondragend, ondragenter, ondragleave, ondragover, ondragstart, ondrop, onfocus, onfocusin, onfocusout, onhelp, onlosecapture, onmouseenter, onmouseleave, onmousewheel, onmove, onmoveend, onmovestart, onpaste, onpropertychange, onreadystatechange, onresize, onresizeend, onresizestart, onselectstart, ontimeerror
Example
Assign the value 5 to the variable <var>x</var>.
Compatibility
HTML 2, 3.2, 4, 4.01, XHTML 1.0, 1.1, Basic
Internet Explorer 2, 3, 4, 5, 5.5, 6
Netscape 1, 2, 3, 4, 4.5-4.8, 6, 7
Opera 4-7
Notes
As a logical element, <var> is a perfect candidate for style sheet binding.
The HTML 2.0 and 3.2 specifications support no attributes for this element.