HTML <var> tagS2C Home   « HTML <var> tag

Definition

The <var> tag is used to define a variable in some text.

Example


<var>markingAVariableInText.</var>

Required Attributes

NONE

Optional Attributes

NONE

Common Attributes

class - specifies a classname for the element allowing you to apply the style of the predefined class to the content.


<var class="classname">Variable name here</var>

id - specifies a unique id for the element allowing you to apply the style of the predefined id to the content.


<var id="idname">Variable name here</var>

style - specifies an inline style for the element allowing you to apply the style to the content.


<var style="color:red;text-align:left">Variable name here</var>

title - specifies extra information about the content.


<var title="information about the content">Variable name here</var>

Language Attributes

dir - specifies the directional flow of the content.


<!-- The text will flow from left to right -->
<var dir="ltr">Variable name here</var>

<!-- The text will flow from right to left -->
<var dir="rtl">Variable name here</var>

lang - specifies a language code for the content of the element.


<var lang="en">Variable name here</var>

xml:lang - specifies a language code for the content of the element in XHTML documents.


<var xml:lang="fr">Variable name here</var>

Document Event Attributes

NONE

Form Event Attributes

NONE

Image Event Attributes

NONE

Keyboard Event Attributes

onkeydown - The JavaScript code to be run when an element is in focus and keyboard key is pressed.


<!-- Executes the go() function -->
<var onkeydown="go()">Variable name here</var>

onkeypress - The JavaScript code to be run when an element is in focus and keyboard key is pressed down and released.


<!-- Executes the go() function -->
<var onkeypress="go()">Variable name here</var>

onkeyup - The JavaScript code to be run when an element is in focus and keyboard key is released.


<!-- Executes the go() function -->
<var onkeyup="go()">Variable name here</var>

Mouse Event Attributes

onclick - The JavaScript code to be run when a mouse is clicked on the element.


<!-- Executes the go() function -->
<var onclick="go()">Variable name here</var>

ondblclick - The JavaScript code to be run when a mouse is double clicked on the element.


<!-- Executes the go() function -->
<var ondblclick="go()">Variable name here</var>

onmousedown - The JavaScript code to be run when the mouse button is pressed down while the cursor is over the element.


<!-- Executes the go() function -->
<var onmousedown="go()">Variable name here</var>

onmousemove - The JavaScript code to be run when the mouse button is moved.


<!-- Executes the go() function -->
<var onmousemove="go()">Variable name here</var>

onmouseout - The JavaScript code to be run when the mouse cursor moves off an element.


<!-- Executes the go() function -->
<var onmouseout="go()">Variable name here</var>

onmouseover - The JavaScript code to be run when the mouse cursor moves over an element.


<!-- Executes the go() function -->
<var onmouseover="go()">Variable name here</var>

onmouseup - The JavaScript code to be run when the mouse button is released while the cursor is over the element.


<!-- Executes the go() function -->
<var onmouseup="go()">Variable name here</var>

go to home page Homepage go to top of page Top