标签为页面上的所有链接规定默认地址或默认目标。
通常情况下,浏览器会从当前文档的 URL 中提取相应的元素来填写相对 URL 中的空白。
使用 标签可以改变这一点。浏览器随后将不再使用当前文档的 URL,而使用指定的基本 URL 来解析所有的相对 URL。这其中包括 、、、
标签必须位于 head 元素内部。
案例:
请注意,我们已经为图像规定了一个相对地址。由于我们已经在 head 部分规定了一个基准 URL,浏览器将在如下地址寻找图片: https://www.gxlcms.com/"https://www.gxlcms.com/http://www.w3school.com.cn/i/eg_smile.gifhttps://www.gxlcms.com/" "https://www.gxlcms.com/http://www.w3school.com.cnhttps://www.gxlcms.com/">W3School 请注意,链接会在新窗口中打开,即使链接中没有 target=https://www.gxlcms.com/"https://www.gxlcms.com/_blankhttps://www.gxlcms.com/" 属性。这是因为 https://www.gxlcms.com/base 元素的 target 属性已经被设置为 https://www.gxlcms.com/"https://www.gxlcms.com/_blankhttps://www.gxlcms.com/" 了。
请注意,我们已经为图像规定了一个相对地址。由于我们已经在 head 部分规定了一个基准 URL,浏览器将在如下地址寻找图片:
https://www.gxlcms.com/"https://www.gxlcms.com/http://www.w3school.com.cn/i/eg_smile.gifhttps://www.gxlcms.com/"
"https://www.gxlcms.com/http://www.w3school.com.cnhttps://www.gxlcms.com/">W3School
请注意,链接会在新窗口中打开,即使链接中没有 target=https://www.gxlcms.com/"https://www.gxlcms.com/_blankhttps://www.gxlcms.com/" 属性。这是因为 https://www.gxlcms.com/base 元素的 target 属性已经被设置为 https://www.gxlcms.com/"https://www.gxlcms.com/_blankhttps://www.gxlcms.com/" 了。
"https://www.gxlcms.com/http://www.w3school.com.cnhttps://www.gxlcms.com/" target=https://www.gxlcms.com/"https://www.gxlcms.com/_blankhttps://www.gxlcms.com/">这个连接 将在新窗口中加载,因为 target 属性被设置为 https://www.gxlcms.com/"https://www.gxlcms.com/_blankhttps://www.gxlcms.com/"https://www.gxlcms.com/。 "https://www.gxlcms.com/http://www.w3school.com.cnhttps://www.gxlcms.com/">这个连接https://www.gxlcms.com/ 也将在新窗口中加载,即使没有 target 属性。
"https://www.gxlcms.com/http://www.w3school.com.cnhttps://www.gxlcms.com/" target=https://www.gxlcms.com/"https://www.gxlcms.com/_blankhttps://www.gxlcms.com/">这个连接 将在新窗口中加载,因为 target 属性被设置为 https://www.gxlcms.com/"https://www.gxlcms.com/_blankhttps://www.gxlcms.com/"https://www.gxlcms.com/。
"https://www.gxlcms.com/http://www.w3school.com.cnhttps://www.gxlcms.com/">这个连接https://www.gxlcms.com/ 也将在新窗口中加载,即使没有 target 属性。
Base 对象代表 HTML 的 base 元素。
在 HTML 文档中 每出现一次,Base 对象就会被创建。