"/> ">

Home >Web Front-end >Front-end Q&A >What is the usage of base in html5

What is the usage of base in html5

藏色散人
藏色散人Original
2023-02-03 10:13:261784browse

The function of the base tag in html5 is to specify the default URL or default target for all relative links on the page. In a document, up to one dde6fb694e6711ae5e6f381704c04ae4 element can be used, and it must be located in 93f0f5c25f18dab9d176bd4f6de5d30e Inside the element, its usage is as follows: "93f0f5c25f18dab9d176bd4f6de5d30e09477266eebbc8a01f42387ae29e71dd b2386ffb911b14667cb8f0f91ea547a76e916e0f7d1e588d4f442bf645aedb2f3a9311b3be0b6330ea47a871d16166f7 9c3bca370b5104690d9ef395f2c5f8d1”.

What is the usage of base in html5

The operating environment of this tutorial: Windows 10 system, HTML5 version, DELL G3 computer

What is the usage of base in html5? The

dde6fb694e6711ae5e6f381704c04ae4 tag specifies the default URL or default target for all relative links on the page.

In a document, at most one dde6fb694e6711ae5e6f381704c04ae4 element can be used. The dde6fb694e6711ae5e6f381704c04ae4 tag must be inside the 93f0f5c25f18dab9d176bd4f6de5d30e element.

Tip: Please place the dde6fb694e6711ae5e6f381704c04ae4 tag as the first element in the 93f0f5c25f18dab9d176bd4f6de5d30e element, so that other elements in the head area can use the information in the dde6fb694e6711ae5e6f381704c04ae4 element.

Note: If the dde6fb694e6711ae5e6f381704c04ae4 tag is used, it must have the href attribute or the target attribute or both attributes.

Example

Specify the default URL and default target of all links on the page:

<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8"> 
<title></title>
<base href="//www.w3cschool.cn/statics/images/w3c/" target="_blank">
</head>
<body>

<p><img src="logo.png" > - 注意这里我们设置了图片的相对地址。能正常显示是因为我们在 head 部分设置了 base 标签,该标签指定了页面上所有链接的默认 URL,所以该图片的访问地址为 "https://www.w3cschool.cn/statics/images/w3c/logo.png"</p>

<p><a href="logo.png">w3cschool logo</a> - 注意这个链接会在新窗口打开,即便它没有 target="_blank" 属性。因为在 base 标签里我们已经设置了 target 属性的值为 "_blank"。</p>

</body>
</html>

Recommended learning: "HTML Video Tutorial

The above is the detailed content of What is the usage of base in html5. 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