Last Updated : 11 Jul, 2025
The <var> tag in HTML is used to define a variable. It is typically used to represent a variable in a mathematical expression or a placeholder that can be updated dynamically with JavaScript
The content inside <var> tag is often styled differently by browsers to indicate that it is a variable, though this can be customized with CSS.
HTML
<!DOCTYPE html>
<html>
<body>
<h1>Mathematical Expression</h1>
<p>
The equation
<var>x</var> + <var>y</var> = <var>z</var>
represents a simple addition.
</p>
</body>
</html>
Syntax
<var> Contents... </var>
Other elements that are used in contexts in which <var>
are commonly used include:
Tags
Description
It displays computer code in a monospaced font.
It represents user input like keyboard keys.
It shows example output from programs.
Italicizes text for emphasis or stress.
More ExampleIn this example we will see the implementation of var tag with help of another example.
HTML
<!DOCTYPE html>
<html>
<body>
<h1>Mathematical Equation</h1>
<p>
Let <var>x</var> be a number.
The equation for calculating <var>y</var> is:
</p>
<p>
<var>y</var> = <var>x <sup>2</sup></var>+ 3<var>x</var> + 2
</p>
<p>
This shows how <var>var</var> tag
is used to indicate variables in
equations or code.
</p>
</body>
</html>
RetroSearch is an open source project built by @garambo | Open a GitHub Issue
Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo
HTML:
3.2
| Encoding:
UTF-8
| Version:
0.7.4