HTML 标签:base
页面上的链接应基于的基础位置。
文档内的相对链接(例如 <a href="someplace.html"… 或 <img src="someimage.jpg"…)将相对于 base 元素指定的 URL。
如果使用,base 元素必须放在 head 元素内,并且只能使用一次。
可选属性
| 属性 | 描述 | 可能的值 |
|---|---|---|
href |
生成相对链接的文档基础地址。 | URL。 |
target |
链接应打开的浏览上下文。 |
|
| 全局属性 | ||
示例
<head>
<title>Peppers</title>
<base href="http://www.somedomain.com/someDirectory/">
</head>
<body>
<p><a href="somePlace.html">This</a> will actually link to http://www.somedomain.com/someDirectory/somePlace.html.</p>
<div><img src="someImage.jpg" alt="Some image"></div>
<p> The location of the above image will be actually be http://www.somedomain.com/someDirectory/someImage.jpg.</p>
</body>
