HTML <base>标签
<base> 标签是 HTML 语言中的基准网址标记,是一个单标签。
<base> 标签位于网页头部文件的 <head> 标签内,一个页面最多只能使用一个 base 元素,用来提供一个指定的默认目标。
实例:<base> 标签实例
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 | <!DOCTYPE html> < html > < head > < meta charset = "utf-8" > < title >你我学习网(niwoxuexi.com)</ title > < base href = "//www.niwoxuexi.com/statics/images/" target = "_blank" > </ head > < body > < p >< img src = "logo.png" > - 注意这里我们设置了图片的相对地址。能正常显示是因为我们在 head 部分设置了 base 标签,该标签指定了页面上所有链接的默认 URL,所以该图片的访问地址为 "https://www.niwoxuexi.com/statics/images/logo.png"</ p > < p >< a href = "logo.png" >你我学习网 logo</ a > - 注意这个链接会在新窗口打开,即便它没有 target="_blank" 属性。因为在 base 标签里我们已经设置了 target 属性的值为 "_blank"。</ p > </ body > </ html > |