在 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 中找