In this short XHTML tutorial you will learn how to use the base tag to make your links (using the a tag) easier to write. First of all, there a two ways to use the base tag: for href and for target. The first method, href, means that all links' href properties will be based off what is in this tag. For example:
Code:
<a href="/lala/">To lala</a>
With this:
Code:
<base href="http://domain.tld" />
Will automatically lead to:
Code:
http://domain.tld/lala/
This is especially useful when using mod_rewrite, and it helps you not having to write out the whole URL everytime. The other way, target will set the link's target to the base value. For instance:
Code:
<base target="_blank" />
Will make it so all links (unless other wise changed with the <a> tag) will open in a new window. The options for target are:
Code:
_blank
_parent
_self
_top
They are all self explanatory as to where they lead. That also concludes this short tutorial, and I hope your coding is now that little bit more efficient!
-
Connor (darkesT)