Name

base — HTML 4.01 | HTML5

Synopsis

HTML: <base>; XHTML: <base/> or <base />

Specifies the base pathname for all relative URLs in the document. Place this element within the head of the document.

Start/End Tags

This is an empty element. In HTML, the end tag is forbidden. In XHTML, the element must be closed with a trailing slash as just shown. Developers may include a space character before the slash for backward compatibility with older browsers.

Attributes

href ="URI"

Required in HTML 4.01. Specifies the absolute URI that acts as the base URI for resolving relative URIs.

id="text"

XHTML and HTML5 only. Assigns a unique identifying name to the element.

target ="name"

Defines the default target window for all links in the document.

Example (HTML)

<head>
    <title>Sample document</title>
    <base href="http://www.example.com/stories/">
</head>

Example (XHTML)

<head>
    <title>Sample document</title>
    <base href="http://www.example.com/stories/" />
</head>

Get HTML & XHTML Pocket Reference, 4th Edition now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.