Home > Web Front-end > HTML Tutorial > In HTML, what is the use of the VAR element type?

In HTML, what is the use of the VAR element type?

PHPz
Release: 2023-08-19 15:09:06
forward
1758 people have browsed it

In HTML, what is the use of the VAR element type?

In this article we will discuss about Var element in HTML. We will learn about its properties and its importance in HTML. And why we specifically use it in mathematical expression. But before we learn about VAR we must know about HTML element.

HTML element is a section of an HTML document that tells the browser how to represent the information of that section. It contains necessary information like instructions, idea of the webpage and main content.

HTML element mainly consists of three parts −

  • Opening tag − It marks the beginning of the HTML element and tells the browser about the starting of the content.

  • Closing tag − It marks the closing of the HTML element and tells the browser where it has to stop looking for content.

  • Content − This part contains the main information of the webpage and it lies between the opening and closing tag. Only this part of the HTML element will be visible to the user on the webpage.

VAR Element

在HTML中,var代表变量。标签用于标记编程或数学表达式中的变量。在编写方程时,通常用于以不同方式显示方程的变量。标签是一个容器标签,即它有开放和结束标签。

默认情况下,元素内的内容在浏览器中呈现为斜体文本,但我们可以通过在元素上应用字体CSS属性来修改它。

Now we will be looking at some examples of using a var tag in different situations.

Example

让我们看一个例子 -

<!DOCTYPE html>
<html lang="en">
<head>
   <title>VAR Element</title>
</head>
<body>
   <h1>This is an example of VAR element in HTML</h1>
   <p> <var>VAR</var> element is used to mark the variable in a mathematical expression or equation. The content written inside the var element renders as <var>italic </var> text on the browser.</p>
</body>
</html>
Copy after login

Example

以下是一个使用 var 元素打印二次方程的示例。

<!DOCTYPE html>
<html lang="en">
<head>
   <title>VAR Element</title>
</head>
<body>
   <h1>This is an example of VAR element in HTML</h1>
   <p>The standard form of a quadratic equation is   <var>a</var><var>x</var><sup>2</sup>+<var>b</var><var>x</var>+<var>c</var>=0 and the basic form of this equation is <var>x</var><sup>2</sup>+<var>b</var><var>x</var>+<var>c</var>=0</p>
</body>
</html>
Copy after login

Example

<!DOCTYPE html>
<html lang="en">
<head>
   <title>VAR Element</title>
</head>
<body>
   <h1>This is an example of VAR element in HTML</h1>
   <p>The area of a 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.  And the area of a rectange is: <var>l</var>x<var>b</var>,where <var>l</var>is the length of the rectangle, and <var>b</var> is the breadth of the rectangle.</p>
</body>
</html>
Copy after login

为什么我们应该在HTML中使用VAR元素

The content that we write between two tags renders differently on the browser, that is somewhat similar to an italicized text. Then the question comes in mind is that why don’t we use an italic tag instead of var tag when all we get is just italic text. The answer to that question is SEO.

SEO − 搜索引擎优化被称为SEO。它有助于改善网站,使其在客户搜索该产品或类似产品时在众多搜索结果中排名更高。这将是有利的,因为更多网站的实际目标受众将能够查看它。此外,它还有助于保持流量和有机流量。

Every tag in HTML is accompanied by some sort of meaning. For instance, the h1 tag identifies a primary heading and all of the text within it is associated with that subject. Below is a list of other HTML tags with unique meanings −

  • Aside − 将其中的内容与主要内容隔离开来。

  • Article tag − isolates the content from the rest of the article.

  • 部分 - 将网站上的内容与其他内容隔离开来。

  • Header − 隔离页面的顶部。

  • Footer − isolates the bottom of the page.

  • Nav − basically contains the navigation menu for the page.

类似于var标签和强调格式具有完全不同的语义含义。标签告知浏览器和搜索引擎,其中包含的信息是某种数学表达式或其结果。然而,斜体语言只是表示作者想要引起对该词的注意。因此,使用标签的文章在搜索引擎优化方面表现更好,排名也比使用斜体或em标签来定义表达式的文章更高。

Example

这是使用VAR元素标记变量的示例 -

<!DOCTYPE html>
<html lang="en">
<head>
   <title>Example</title>
</head>
<body>
   <h1>Marking variable using VAR element</h1>
   <p><var>VAR</var> element is used to mark the variable in a mathematical expression or equation.</p>
</body>
</html>
Copy after login

Example

这是使用斜体元素标记变量的示例 -

<!DOCTYPE html>
<html lang="en">
<head>
   <title>Example</title>
</head>
<body>
   <h1>Marking variable using Italic element</h1>
   <p><i>VAR</i> element is used to mark the variable in a mathematical expression or equation.</p>
</body>
</html>
Copy after login

正如我们所看到的,VAR和Italic元素生成相同的输出,但是使用VAR标签的网页将在搜索结果中排名靠前,即使它们的内容是相同的。

结论

In this article we discussed about VAR element in HTML. We learnt about different ways of using VAR element and at last we discuss how we can use it for better search engine optimization.

The above is the detailed content of In HTML, what is the use of the VAR element type?. For more information, please follow other related articles on the PHP Chinese website!

source:tutorialspoint.com
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template