HTML <var> tag
Definition and Usage
<var>
The tag is used to define variables in programming or mathematical expressions. The content inside the tag is usually displayed in italic.
Tip:This tag is not deprecated. However, using CSS can achieve richer effects.
See also:
Tag | Description |
---|---|
<code> | Define variables. |
<samp> | Define the sample output of a computer program. |
<kbd> | Define keyboard input. |
<pre> | Define preformatted text. |
See also:
HTML Tutorial:HTML Text Formatting
HTML DOM Reference Manual:Variable Object
Example
Define some text as a variable in the document:
The area of the triangle is: 1/2 x <var>b</var> x <var>h</var>, where <var>b</var> is the base and <var>h</var> is the vertical height.
Global Attributes
<var>
The tag also supports Global Attributes in HTML.
event attributes
<var>
The tag also supports Event Attributes in HTML.
Default CSS Settings
Most browsers will display the following default values <var>
Element:
var { font-style: italic; }
Browser Support
Chrome | Edge | Firefox | Safari | Opera |
---|---|---|---|---|
Chrome | Edge | Firefox | Safari | Opera |
Support | Support | Support | Support | Support |