News:

This week IPhone 15 Pro winner is karn
You can be too a winner! Become the top poster of the week and win valuable prizes.  More details are You are not allowed to view links. Register or Login 

Main Menu

HTML tag tutorial - Creating hyperlinks on web pages

Started by ben2ong2, October 03, 2006, 06:06:42 PM

Previous topic - Next topic

0 Members and 2 Guests are viewing this topic.

ben2ong2

HTML documents contain certain 'hot spots'. These hot spots provide anchors that link to other documents/files on the Internet. The stupendous growth of the Internet and the WWW is attributed to these tags. It's hard to imagine a network without links and interlinks.

Lets look at this tag in detail.

You are not allowed to view links. Register or Login
is displayed as This will take you to You are not allowed to view links. Register or Login's main page.

Anchor tags have a starting (<A>) and an (</A>) ending tag.
The HREF attribute is required and takes the URL address of the destination page as value. Without this attribute-value, no links will be created.
Some text is enclosed between the anchor tags. This text serves as the hot spot. When a visitor clicks on this 'hot spot', he or she will be transported to the target page.
Another attribute is TITLE, through which you can provide some explanatory text for that link. Netscape ignores this attribute. To see this attribute in action, place your mouse over the link.

Homepage
Its code is:

<A HREF="You are not allowed to view links. Register or Login"
TITLE="This takes you to You are not allowed to view links. Register or Login's mainpage"
>Homepage</A>


Linking in the same document
So far we have discussed only inter-document linking. What if you want to make the visitor jump to different sections of the SAME page? We employ the <A> tag in this case too, but its format changes slightly. Instead of a URL in the HREF attribute, we use names.

Click here to go to the top.
First, an anchor is set at the desired place in the document using the NAME attribute. In this case I put the following code at the top of the page.

<A NAME="top"></A>

The value of NAME attribute can be anything you want. Also note, that it is not necessary to enclose any text or other HTML element if the anchor tag is used in this manner.

After setting an anchor with its NAME attribute we employ another set of <A> to make a link that points to it:

<A HREF="#top" CLASS="text">Click here to go to the top</A>.
On clicking this link, you will be taken to the top of the page where I have put the anchor. The HREF attribute takes the value of the NAME attribute mentioned before as its value; the name is prefixed with a # symbol.



You are not allowed to view links. Register or Login
You are not allowed to view links. Register or Login