Supported by :   My Law Forms Ltd. - Deed polls and Tenancy Agreements

XHTML help: basics – page links and anchors

One of the foundational elements on the web are links, or addresses to other web pages on the Internet. Links can be internal to your website or external, pointing toward some other resource on the web. Your basic link uses the tag <a>, for anchor, and it looks like this:

<a href="">Site to Link to</a>

In order to make this link a little more usable, you need to include the title attribute. The title just gives a little more information about the link so that a person can make a decision about whether they want to check it out. It may be used to indicate whether the link is external, but this is not a requirement. It can also be used by accessibilty tools to provide additional details for speciality browsers.

<a href="" title="External link to Site to Link to">Site to Link to</a>

If you have a link on your page with an id attribute, you can easily link to it by using a hash (or pound) sign followed by the value of the id.

<a href="#dogs">Dogs</a>

Links to:<p id="dogs">Dogs are really fun!</p>

An older way to do this would be to use the name attribute. This is often used to reference the “top” of a page.

<a name="top" ></a>

<a href="#top">Top of page</a>

There is one more attribute you should be aware of, the target attribute. This attribute can tell the browser to open a link in another page with the value “_blank”. This can undermine the natural flow of web browsing for users, but may sometimes be desirable to ensure a current page is kept visible. It can be confusing to a lot of users when a new window pops open every time you click a link.

<a href="">Site to Link to</a>

By using a named target, it is possible to request that a browser “Open a new window, but if we already have one named
htmlhelp, then re-use this one”

<a href="" target="htmlhelp" >Link to HTML help window</a>

Link to HTML help window

This entry was posted on Monday, April 16th, 2007 at 5:01 pm and is filed under XHTML tips. You can follow any responses to this entry through the RSS 2.0 feed. Both comments and pings are currently closed.

Comments are closed.