Open In App

HTML <var> Tag

Last Updated : 26 Dec, 2023
Improve
Improve
Like Article
Like
Save
Share
Report

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

<code>

It displays computer code in a monospaced font.

<kbd>

It represents user input like keyboard keys.

<samp>

It shows example output from programs.

<em>

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>
 
    <!-- HTML var Tag is used here-->
    <var>GeeksforGeeks Variable</var>
 
</body>
 
</html>


Output: 

Screenshot-2023-12-22-105925

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>
 
    <!-- 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:

Screenshot-2023-12-22-110500

Supported Browsers: 

  • Google Chrome 1
  • Edge 12
  • Firefox 1
  • Opera 15
  • Safari 4


Like Article
Suggest improvement
Previous
Next
Share your thoughts in the comments

Similar Reads