What is the function of base tag in html

云罗郡主
Release: 2019-01-31 16:44:00
Original
5109 people have browsed it

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 thetag. 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,,,

tags.

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

html base tag example

   

请注意,我们已经为图像规定了一个相对地址。由于我们已经在 head 部分规定了一个基准 URL,浏览器将在如下地址寻找图片:

"//m.sbmmt.com/tpl/Index/Static/img/banner7.jpg"



php中文网

请注意,链接会在新窗口中打开,即使链接中没有 target="_blank" 属性。这是因为 base 元素的 target 属性已经被设置为 "_blank" 了。

Copy after login


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!

source:php.cn
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
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template
About us Disclaimer Sitemap
php.cn:Public welfare online PHP training,Help PHP learners grow quickly!