Welcome, Guest. Please Login or Register!

Tutorial Site

Using the Base Tag

Rate:

Posted on 2006-12-07 by darkesT

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)


There are 0 comments on Using the Base Tag

There a no comments yet, be the first!

You must be logged in to comment!

Navigation

Categories

Newest Members

Users Online (0)

0 member(s) and 0 guest(s)

Affiliates

Portfolio of Connor Wilson | Connor Wilson- 68 hit in and 286 hits out.

The largest tutorial database on the net! | Pixel2Life- 479 hit in and 245 hits out.

The FREE and EASY way to get extra traffic! | TheTopTopSites- 141 hit in and 325 hits out.

An Awsome Online Tutorialing Community | The-Tutorial- 160 hit in and 261 hits out.

View All :: Apply