HTML <var> Tag is a phrase tag used to define the variable in a mathematical equation or a computer program. The content of this tag is displayed in an italic format in most browsers.
Note: This tag is not deprecated, but by using CSS we can achieve better effects.
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. |
Example: In this example we will see the implementation of var tag with help of a example.
<!DOCTYPE html> < html lang = "en" >
< head >
< meta charset = "UTF-8" >
< meta name = "viewport"
content = "width=device-width, initial-scale=1.0" >
< title >var Tag Example</ title >
< style >
body {
background-color: #f4f4f4;
text-align: center;
}
</ style >
</ head >
< body >
< h1 style = "color: green;" >
GeeksforGeeks
</ h1 >
< h3 >
< var >This is a variable</ var >
</ h3 >
<!-- HTML var Tag is used here-->
< var >GeeksforGeeks Variable</ var >
</ body >
</ html >
|
Output:
Example: In this example we will see the implementation of var tag with help of another example.
<!DOCTYPE html> < html lang = "en" >
< head >
< meta charset = "UTF-8" >
< meta name = "viewport"
content = "width=device-width, initial-scale=1.0" >
< title >var Tag Example</ title >
< style >
body {
background-color: #f4f4f4;
text-align: center;
font-family: Arial, sans-serif;
}
h1 {
color: green;
}
img {
display: block;
margin: 20px auto;
}
</ style >
</ head >
< body >
< img src =
< h1 >GeeksforGeeks</ h1 >
<!-- HTML var Tag is used here -->
< h3 >
< var >This is a variable</ var >
</ h3 >
< var >GeeksforGeeks Variable</ var >
< p >
The < var >< var ></ var > tag is used to
define a variable in programming or in
a mathematical expression. It is typically
displayed in an italic font to differentiate
it from the surrounding text.
</ p >
</ body >
</ html >
|
Output:
Supported Browsers:
- Google Chrome 1
- Edge 12
- Firefox 1
- Opera 15
- Safari 4