Trusted answers to developer questions
Trusted Answers to Developer Questions

Related Tags

html
var

How to use the var element in HTML

Ayesha Naeem

Grokking Modern System Design Interview for Engineers & Managers

Ace your System Design Interview and take your career to the next level. Learn to handle the design of applications like Netflix, Quora, Facebook, Uber, and many more in a 45-min interview. Learn the RESHADED framework for architecting web-scale applications by determining requirements, constraints, and assumptions before diving into a step-by-step design process.

widget

The <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.

Note: The <var> element supports all global attributes and event attributes.

Syntax

Example

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.

RELATED TAGS

html
var

Grokking Modern System Design Interview for Engineers & Managers

Ace your System Design Interview and take your career to the next level. Learn to handle the design of applications like Netflix, Quora, Facebook, Uber, and many more in a 45-min interview. Learn the RESHADED framework for architecting web-scale applications by determining requirements, constraints, and assumptions before diving into a step-by-step design process.

Keep Exploring