HTML <var> Tag
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.
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;" > w3wiki </ h1 > < h3 > < var >This is a variable</ var > </ h3 > <!-- HTML var Tag is used here--> < var >w3wiki 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 = "https://media.w3wiki.net/gfg-gg-logo.svg" alt = "w3wiki Logo" > < h1 >w3wiki</ h1 > <!-- HTML var Tag is used here --> < h3 > < var >This is a variable</ var > </ h3 > < var >w3wiki 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
Contact Us