HTML <var> Tag
Topic: HTML5 Tags ReferencePrev|Next
Description
The <var> (short for variable) tag is used to indicate that the text is an instance of a variable or program argument.
The following table summarizes the usages context and the version history of this tag.
| Placement: | Inline |
|---|---|
| Content: | Inline and text |
| Start/End Tag: | Start tag: required, End tag: required |
| Version: | HTML 2, 3.2, 4, 4.01, 5 |
Syntax
The basic syntax of the <var> tag is given with:
The example below shows the <var> tag in action.
Example
Try this code »<p>A simple equation: <var>x</var> = <var>y</var> + 2 </p>
Tag-Specific Attributes
The <var> tag doesn't have any specific attribute.
Global Attributes
Like all other HTML tags, the <var> tag supports the global attributes in HTML5.
Event Attributes
The <var> tag also supports the event attributes in HTML5.
Browser Compatibility
The <var> tag is supported in all major modern browsers.
Basic Support—
|
Further Reading
See tutorial on: HTML Text Formatting.
Related tags: <code>, <kbd>, <pre>.

