All Snippets
Top 100 Snippets

By Language

GBIC >> Source Code >> HTML >> Snippet

08 Links

..Click on a link and it will take you to the location specified
in the anchor tag.  In the following example, clicking on the
text 'My Web Site' will direct the browser to go to the
URL ' http://www.garybeene.com ':

< a href = " http://www.garybeene.com " > My Web Site </ a >

The anchor tag can also be used to move to a new position on
the current page like this:

First, put this line of HTML code in the document as a point to which
you want to be able to jump:

< a name = "home" >

Then, this line of HTML code will create a link to jump to that location:

< a href = "#home" > Jump </ a >

The #-sign notation can also be used in the first example, like this:

< a href = " http://www.garybeene.com#home " > My Web Site </ a >

This allow you to jump to the middle of a web page instead of only
being able to go to the top of a web page as a normal link would allow.

An image can also be made to act as a link by placing the < img > tag
inside the anchor tag, as in this example:

< a href = " http://www.garybeene.com " >< img src = "mypicture.jpg" ></ a >