QUICK LINKS

LINKS

Links are created using the a (for anchor) tag. A destination is determined as well as what will actually be used as the link, whether it be text, a picture, a menu, or anything else otherwise specified.

The most common attributes within the a tag are href, for the destination, and target, allowing the link to open in a different window/frame etc.

A typical line of code will look like this:

<a href=”http://www.homestarrunner.com”> Homestarrunner </a>

Here, the href points to the site www.homestarrunner.com. After the a tag opens, the word Homestarrunner becomes the link to be clicked, thereafter closing the a tag.

Similarly, the href attribute can point to local pages on your own site. Instead of a web address, href will simply point to the page itself. It would look something like this:

<a href=”about_pudgy_ninja.html”> About Pudgy Ninja </a>

Adding the target attribute will change the way the destination loads. Adding _blank will open the link in a new window. Other attributes will work with frames, however they are nearly completely useless at this point. Even opening a new window with _blank is rarely recommended. When needed, the code would look like this:

<a href=”home.html” target=“_blank”> Home </a>

Quick Reference

<a></a>
Basic tag

href=”www.something.com”
Link to absolute url

href=”something.html”
Link to relative url

target=”_blank”
Opens link in new window

target=”_self”
Replace current page

target=”_parent”
Replace page it came from

target=”_top”
Loads in current browser