English | 简体中文 | 繁體中文 | Русский язык | Français | Español | Português | Deutsch | 日本語 | 한국어 | Italiano | بالعربية

HTML-Referenzhandbuch

HTML-Tag-Übersicht

HTML: <base> href Eigenschaft

<base>-Tag legt für alle relativen URLs in einem Dokument eine Grund-URL fest /Ein Dokument kann maximal einen <base>-Element enthalten, und dieses muss im <head>-Element stehen.

 HTML <base> Tag

Online-Beispiel

Legen Sie eine Standard-URL und ein Standardziel für alle Links auf der Seite fest:

<!DOCTYPE html>
<html>
<head>
<title>HTML:<base> href Eigenschaft - Grundtutorialsite oldtoolbag.com</title>
<base href="https://de.oldtoolbag.com/" target="_blank">
</head>
<body>
<p>Bitte beachten Sie, dass wir nur relative Adressen für Bilder angegeben haben. Da wir im Header die Grund-URL spezifiziert haben, wird der Browser "https://de.oldtoolbag.com/static/images/colormap.gif”处查找图像</p>
<img src="static/images/colormap.gif" width="234" height="199" alt="colormap">
<a href="tags/Tag-base.html">HTML base Tag</a>
</body>
</body>
</html>
Test it out ‹/›

Browser Compatibility

IEFirefoxOperaChromeSafari

All major browsers support the href attribute.

Definition and Usage

The <base> tag specifies the base URL for all relative URLs in the document /Target.
A document can contain at most one <base> element, and this element must be within the <head> element.

Note: If the <base> tag exists, it must have a href attribute or a target attribute, or both.

HTML 4.01and HTML5Differences

None.

Differences between HTML and XHTML

In HTML, the <base> tag does not have a closing tag.
In XHTML, the <base> tag must be closed correctly.

Event Attributes

None. The <base> tag does not support any event attributes.

Syntax

<base href="URL">

Attribute Value

ValueDescription
URLas an absolute URL for the base URL (e.g. "https://de.oldtoolbag.com/)。

 HTML <base> Tag