Home >Web Front-end >HTML Tutorial >What is the function of base tag in html

What is the function of base tag in html

云罗郡主
云罗郡主Original
2019-01-31 16:44:005233browse

What is the role of the base tag in html?

Function: Specifies the default address or default target for all links on the page. It is a label that expresses the path and connection URL.

Note: Normally, the browser will extract the corresponding elements from the URL of the current document to fill in the blanks in the relative URL. This can be changed using the dde6fb694e6711ae5e6f381704c04ae4 tag. The browser will then no longer use the URL of the current document, but will use the specified base URL to resolve all relative URLs. This includes URLs in 3499910bf9dac5ae3c52d5ede7383485, a1f02c36ba31691bcfe87b2722de723b, 2cdf5bf648cf2f33323966d7f58a7f3f, ff9c23ada1bcecdd1a0fb5d5a0f18437 tags.

Note: In HTML, the dde6fb694e6711ae5e6f381704c04ae4 tag does not have a closing tag; in XHTML, the dde6fb694e6711ae5e6f381704c04ae4 tag must be closed correctly. The dde6fb694e6711ae5e6f381704c04ae4 tag must be inside the head element.

html base tag example

100db36a723c770d327fc0aef2ce13b1

<head>
<base href="http://www.php.cn/tpl/Index/Static/img/" />
<base target="_blank" />
</head>
<body>
<img src="banner7.jpg" /><br />
<p>请注意,我们已经为图像规定了一个相对地址。由于我们已经在 head 部分规定了一个基准 URL,浏览器将在如下地址寻找图片:</p>
<p>"http://www.php.cn/tpl/Index/Static/img/banner7.jpg"</p>
<br /><br />
<p><a href="http://www.php.cn">php中文网</a></p>
<p>请注意,链接会在新窗口中打开,即使链接中没有 target="_blank" 属性。这是因为 base 元素的 target 属性已经被设置为 "_blank" 了。</p>
</body>
</html>


The above is the detailed content of What is the function of base tag in html. For more information, please follow other related articles on the PHP Chinese website!

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

Related articles

See more