HTML Tag: base
The base location from which links on a page should be made.
Relative links within a document (such as <a href="someplace.html"…
or <img src="someimage.jpg"…
) will become relative to the URL specified by the base
element.
If used, the base
element must be placed inside the head
element and it should only be used once.
Optional Attributes
Attribute | Description | Possible values |
---|---|---|
href |
The document base address from which relative links are made. | URL. |
target |
The browsing context in which the links should open. |
|
Global attributes |
Example
<head>
<title>Peppers</title>
<base href="http://www.somedomain.com/someDirectory/">
</head>
<body>
<p><a href="somePlace.html">This</a> will actually link to http://www.somedomain.com/someDirectory/somePlace.html.</p>
<div><img src="someImage.jpg" alt="Some image"></div>
<p> The location of the above image will be actually be http://www.somedomain.com/someDirectory/someImage.jpg.</p>
</body>