HTML var tag and element
1. HTML var element represents a variable in a mathematical expressing or an argument in a piece of code.
Syntax
<var>text content</var>
Category
HTML var element is a Phrase element.
Whether both start and end tags are required
Yes.
Can contain
HTML var element can contain inline elements.
Can reside within
HTML var element can reside within inline as well as block level elements.
Attributes
Attributes specific to this element
None.
Identifiers
language information and text direction
Title
Style
Events
onclick, ondblclick, onmousedown, onmouseup, onmouseover, onmousemove, onmouseout, onkeypress, onkeydown, onkeyup.
Supported doctypes
HTML 4.01 strict, HTML 4.01 transitional, HTML 4.01 frameset.
Example of using HTML var element
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
<title>HTML var tag example - HTML tutorial | w3resource</title>
</head>
<body>
<p>This is an example of <var>HTML var tag.</var></p>
</body>
</html>
Result
![html var element](https://www.w3resource.com/w3r_images/html-var-element.png)
View this example in a separate browser window
Pictorial presentation
![html var element](https://www.w3resource.com/w3r_images/html-var.png)
Previous: HTML kbd tag and element
Next: HTML cite tag and element
Test your Programming skills with w3resource's quiz.
- Weekly Trends and Language Statistics
- Weekly Trends and Language Statistics