HomeReferencesHTML Tags

HTML Tag: base

Defines the base location for links on a page.

Relative links within a document (such as <a href="someplace.html"... or <img src="someimage.jpg"...) will become relative to the URI specified in the base tag.

The base tag must go inside the head element.

HTML Dog, The Book HTML Dog book cover

HTML Dog is hosted by Titan Internet

Required Attributes

  • href is used to specify the location on the base URI.

Optional Attributes

  • None.

Example


<head>
	<title>Peppers</title>
	<base href="http://www.somedomain.com/directory/" />
</head>
<body>
	<p><a href="someplace.html">This</a> will actually link to http://www.somedomain.com/directory/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/directory/someimage.jpg.</p>
</body>