HTML Home
HTML Tags Reference
Selected Reading
© 2011 TutorialsPoint.COM
|
HTML <base> tag
Function:
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.
Difference between HTML and XHTML:
In HTML the <base> tag has no end tag.
In XHTML the <base> tag must be properly closed.
Example:
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" />
|
Online Practice:
To Become more comfortable - Do Online Practice
Attributes:
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.
- _blank - the target URL will open in a new window
- _self - the target URL will open in the same frame as it was clicked
- _parent - the target URL will open in the parent frameset
- _top - the target URL will open in the full body of the window
|
|
|
|