在 html 页面中,可以使用 <base> 标签来修改 <a> 的默认行为,如:
<html>
<head>
<base target="_blank"/>
</head>
<body>
<a href="http://google.com">Google</a>
</body>
</html>
这时点击 Google 会在新页面中打开,即使 <a> 中没有指定 target=_blank 。
<base> 的另外的用法是可以指定当前 html 文档中的相对路径,如:
<base href="http://mysite/images/" />
<img src="5.gif"/>
这时 <img> 会默认从 http://mysite/images/5.gif 中找