head tag
a tag
TAG: base
<base />
The
base
tag is used to define the base URL for the HTML document. This allows the use of relative URL addresses elsewhere in the document. Interestingly, this base URL does not have to be an absolute URL, but rather, it can be a relative URL.
Also, when a browser arrives from another site to your site via a link, you can use the
target
attribute of this tag to ensure that your site does not appear inside a frame or window of the previous site. In other words, your site will always appear as the top window.
The
base
tag must be placed between the opening and closing
head
tags.
This is a self-closing tag. The blank space before the slash (/) is recommended for maximum browser compatibilty.
Attributes and Events
href
The
href
attribute is mandatory. It is used to define the base URL.
target
- not allowed in Strict XHTML
The
target
attribute specifies the default name of the frame or window in which all of the target pages should appear when a link is clicked on your site. However, this can be overridden by a
target
attribute that is inside an
a
tag. The four reserved names are
_blank, _parent, _self,
and
_top
.
In this example, the link in the
body
resolves to:
http://www.devguru.com/Technologies/HTML/quikref/html_index.html
Code:
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "DTD/xhtml-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="eng">
<head>
<title>DevGuru XHTML base Tag Example</title>
<
base href="http://www.devguru.com/"
>
</head>
<body>
<a href="/Technologies/HTML/quikref/html_index.html">HTML Index</a>
</body>
</html>
This code directs that your site always appears as the top window.
Code:
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "DTD/xhtml-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="eng">
<head>
<title>DevGuru XHTML base Tag Example</title>
<
base target="_top"
>
</head>
<body>
...
</body>
</html>
Copyright 1999-2001 by Infinite Software Solutions, Inc. All rights reserved.
Trademark Information