html The base tag is used to specify the default address or default target for all links on the page. It is a tag that expresses the path and connection URL. Normally, the browser will extract the corresponding element from the URL of the current document. Fill in the blanks in relative URLs.
#html How to use base tag?
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
Note:
In HTML, the
html base tag usage example
<html> <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 How to use html base tag. For more information, please follow other related articles on the PHP Chinese website!