<var> element in HTML defines a text as a variable and can be used to define variables of a mathematical expression or variables of a piece of code. The text enclosed in the
<var> element is normally displayed in italics.
<var>element supports all global attributes and event attributes.
The following example demonstrates how to use the
<var> element in HTML.
The example above shows the code to add two numbers written in HTML. Each of the variables appears italicized because they are enclosed in a
<var> tag. The
<br> tag is added for formatting.
View all Courses