HTML <var> Tag

The <var> tag describes variable in a mathematical expression or a programming context. Its content is usually presented in an italicized version of the current typeface.

Other elements that are used for describing technical parts of the documents in the contexts in which <var> is generally used include:

  • the <code> tag, which defines a piece of computer code
  • the <samp> tag, which defines sample output from a computer program or script
  • the <kbd> tag, which defines keyboard output

Syntax

The <var> tag comes in pairs. The content is written between opening (<var>) and closing (</var>) tags.

Example

Example 
<!DOCTYPE html>
<html>
  <head>
    <title>Title of the document</title>
  </head>
  <body>
    <var>This is a variable</var>
  </body>
</html>

Result

Attributes

The <var> tag supports the Global attributes and the Event Attributes.

Browser support