HTML Tutorial

HTML Tag: <var>

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

Usage of <var>

  • Use <var> to highlight a variable name or expression.
  • It visually distinguishes variables from surrounding text.

Attributes of <var>

  • None.

Examples with <var>

<p>The value of the variable <var>x</var> is 5.</p>
<p>The formula for calculating area is: Area = <var>πr²</var></p>

Exploring the <var> Tag

<!DOCTYPE html>
<html>
<body>
  <p>Variable <var>name</var> is initialized to the value <var>value</var>.</p>
</body>
</html>

Output:

Variable name is initialized to the value value.