HTML <var> Tag
Last Updated :
26 Dec, 2023
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:
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.
HTML
<!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 >
< var >GeeksforGeeks Variable</ var >
</ body >
</ html >
|
Output:Â
Example:Â In this example we will see the implementation of var tag with help of another example.
HTML
<!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 >
< 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
Share your thoughts in the comments
Please Login to comment...