html base tag


  Translation results:

UK[beɪs] 美[bes]

n. Base; basis; based on; base number (such as decimal 10 and binary 2)

vt. Based on; build... on ;Put... on or set up (base); put... on the base (or pedestal)

adj. despicable; low-level; cheap, inferior; commoner

Third person singular: bases Plural: bases Present participle: basing Past tense: based Past participle: based Comparative: baser Superlative: basest

html base tagsyntax

What is the function of 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 <base> 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 <a>, <img>, <link>, <form> tags.

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

html base tagexample

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

Run instance »

Click the "Run instance" button to view the online instance

Popular Recommendations

Home

Videos

Q&A