HTML Var Tag

In HTML, the <var> tag stands for the variable and used to display the variable of a program on the web page.

  • The <var> tag is used to represent a variable either in a programming context or a variable in a mathematical equation.

  • The <var> tag falls under the category of phrase tag.

  • The <var> tag has a browser-dependent behavior.

HTML <var> tag - Syntax and Usage

The <var> tag requires the start(opening) tag and end(closing) tag.

The following is the required syntax for the same:

<var>
...content here
</var>

HTML <var> Tag Basic Example

Below we have a basic example to show the usage of the <var> tag:

Usage of <var> tag to enclose the name of two variables

<p>The variables <var>minSpeed</var> and <var>maxSpeed</var> control
   the minimum and maximum speed of the apparatus in revolutions
   per minute (RPM).</p>

HTML <var> Tag Attributes

This tag does not have any specific attributes although this element supports Global and Event attributes.

Default CSS Settings for HTML <var> Tag

Given below are the default CSS settings used by most of the browsers for the HTML <var> tag:

var {
  font-style: italic;
}

Browser Support for HTML<var> Tag

Following browsers support this attribute:

  • Google Chrome 9.0

  • Internet Explorer 11.0

  • Firefox 4+

  • Opera

  • Safari