<var>

The HTML <var> element denotes a variable in mathematical expressions or programming contexts, usually displayed in italics to signify that its value may vary.

<var> Tag

The <var> tag in HTML is used to indicate a variable in mathematical expressions or programming code. By default, browsers render the text inside this tag in italics.

Syntax

index.html
<var>variable-name</var>

<var> Demo

A simple equation: x = y + 2

index.html
<p>
  A simple equation: <var>x</var> = <var>y</var> + 2
</p>

Attributes

This element supports only the global attributes.

Conclusion

The <var> tag in HTML is used to represent variables in mathematical expressions and programming contexts, making equations and code more readable. The text is typically displayed in italics, helping to visually differentiate variables from regular text. This tag enhances the structure and clarity of technical content on web pages.