The <base> tag use to specify the base URL adress for all relative URLs in Webpage.
Once you set the base url in the header then all subsequent relative links will use that URL as a starting point.
The tag has no end tag in HTML but in XHTML it must be closed properly.
You can understand it by a simple example:-
The following attributes can be set for the </base> tag:-
You can understand it by a simple example:-
e.g.
<head>
<title>Indianwebschool</title>
<base href="http://www.indianwebschool.com/">
</head>
<body>
<p><a href="contact.html"></a>
<div><img src="images/logo.jpg" alt="logo" /></div>
</body>
Result:-
<head>
<title>Indianwebschool</title>
<base href="http://www.indianwebschool.com/">
</head>
<body>
<p><a href="contact.html"></a>
<div><img src="images/logo.jpg" alt="logo" /></div>
</body>
Result:-

The location of the above image is http://www.indianwebschool.com/images/logo.jpg.
In the above example the main url once specified in <base> tag and then the end of url have to add.
in the above example the main url is 'http://www.indianwebschool.com/' and end part of urls are different that is in case of anchor tag is 'contact.html' while
in the image url end part is 'images/logo.jpg'.
The following attributes can be set for the </base> tag:-
Attribute | Value | Description |
---|---|---|
href | URL | specify url |
target | _blank _parent _self _top |
Target where location will be open |
it's nic
ReplyDelete