HTML <base>タグ


ページ上のすべてのリンクのデフォルトのURLとデフォルトのターゲットを指定します。

<head>
  <base href="https://www.w3schools.com/" target="_blank">
</head>

<body>
<img src="images/stickman.gif" width="24" height="39" alt="Stickman">
<a href="tags/tag_base.asp">HTML base Tag</a>
</body>

定義と使用法

タグは、ドキュメント内のすべての相対URLの<base>ベースURLおよび/またはターゲットを指定します。

<base>タグには、hrefまたはtarget属性のいずれか、あるいはその両方が存在する必要があります

ドキュメント内に存在できる<base>要素は1つだけであり、<head>要素内にある必要があります。


ブラウザのサポート

Element
<base> Yes Yes Yes Yes Yes

属性

Attribute Value Description
href URL Specifies the base URL for all relative URLs in the page
target _blank
_parent
_self
_top
Specifies the default target for all hyperlinks and forms in the page

グローバル属性とイベント

この<base>タグは 、HTMLのグローバル属性もサポートしています。


イベント属性

 タグは<base>イベント属性をサポートしていません。


関連ページ

HTML DOMリファレンス:ベースオブジェクト


デフォルトのCSS設定

なし。