Copyright © tutorialspoint.com
The HTML <base> tag is used to specify a base URI, or URL, for relative links. For example, you can set the base URL once at the top of your page in header section, then all subsequent relative links will use that URL as a starting point.
In HTML the <base> tag has no end tag.
In XHTML the <base> tag must be properly closed.
Assume that the absolute address for an image is:
<img src="http://www.tutorialspoint.com/images/html.gif" /> |
Now we insert the <base> tag, which specifies a base URL for all of the links in a page as follows:
This will produce following result:
<head> <base href="http://www.tutorialspoint.com" /> </head> |
Now you do not need to use complete path of the image. You can insert above image as follows:
<img src="/images/html.gif" /> |
To Become more comfortable - Do Online Practice
Attribute | Value | Description |
---|---|---|
href | URL | Specifies the URL of a page or the name of the anchor that the link goes to. |
target | _blank _parent _self _top | Where to open the target URL.
|
Copyright © tutorialspoint.com