Read + Write + Report
Home | Start a blog | About Orble | FAQ | Sites | Writers | Advertise | My Orble | Login

Basic Html 3: Hyperlinks

July 13th 2006 05:35
Well today we're going to deal with links: those pieces of writing that take you to another website when you click on them.

These links are called anchors and use the <a>your text here</a> tags. However, as with the <font> tag, you generally add more information to these. So the general link to a website is:

<a href="url">your text here</a>

So to link to http://www.google.com you would write <a href="http://www.google.com"> This links to Google</a>

If you are linking to a website that is in the same directory then you can just write the website name. So if you save this as "lesson3.html" in your lessons folder and then create a basic website:


<html>
<head>
<title>Lesson 3</title>
<head>
<body>
your text here
</body>
</html>

and where it says your text here you write:

<a href="lesson1.html">This is the first lesson we learned</a>
<a href="lesson2.html">This is the second lesson we learned</a>
<a href="http://www.google.com">This is a link to Google</a>

you will see the way the different links work (although you may find the page looks neater if you insert a break [by writing <br>] after every link.)

You can also use hyperlinks to move to a specific place within a document. You do this be creating an anchor at the place you want to jump to, by enclosing the heading in an anchor tag like below:

<a name="anchorname">your text here</a>

and to navigate to that section you write the link, followed by #anchorname where anchorname was whatever you named the anchor.


To experiment with this just create a new website and save it as "extra.html". Add the following code.

<html>
<head>
<title>Extra</title>
<head>
<body>
<a href="#second">This link takes us to part 2 of this page</a>
<p>This is the first part of extra</p>
<br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br>
<p><a name="second"> This is the second part of extra.</a></p>
</body>
</html>

I have added all the breaks in so it is easy to see the difference between the first part and the second part.

You may not the line: <a href="#second">This link takes us to part 2 of this page</a>

This shows you how to navigate to a particular part of a website if you are already in that website. You just go straight to the #anchorname part of the code.

Now go back to lesson3.html and add two more links after the others:

<br>
<a href="extra.html">This links to the extra website</a><br>
<a href="extra.html#second">This takes us straight to the second part of extra</a>

So lesson3.html should look like:

<html>
<head>
<title>Lesson 3</title>
<head>
<body>
<a href="lesson1.html">This is the first lesson we learned</a><br>
<a href="lesson2.html">This is the second lesson we learned</a><br>
<a href="http://www.google.com">This is a link to Google</a>
<br>
<a href="extra.html">This links to the extra website</a><br>
<a href="extra.html#second">This takes us straight to the second part of extra</a>
</body>
</html>

Now open lesson3.html by clicking on it so it opens in your web browser and play around.

And that is hyperlinks. If you have any questions then just add a comment and I will try to answer them.

Adam

83
Vote
Shared on


   
Subscribe to this blog 


Just this blog This blog and DailyOrble (recommended)

   

   

   


Add A Comment

To create a fully formatted comment please click here.


CLICK HERE TO LOGIN | CLICK HERE TO REGISTER

Name or Orble Tag
Home Page (optional)
Comments
Bold Italic Underline Strikethrough Separator Left Center Right Separator Quote Insert Link Insert Email
Notify me of replies
Notify extra people about this comment
Is this a private comment?
List the Email Addresses or Orble Tags of the people you would like to be notified about this comment


One per line max of 30

List the Email Addresses or Orble Tags of the people you would like to be notified about this private comment thread. Only the people in this list will be able to see or reply to your comment.


One per line max of 30

Your Name
(for the email going out to the above list, it can be different to your Orble Tag)
Your Email Address
(optional)
(required for reply notification)
Submit
More Posts
1 Posts
6 Posts
7 Posts dating from July 2006
Email Subscription
Receive e-mail notifications of new posts on this blog:
0
Moderated by Blog Cemetery
Copyright © 2006 2007 2008 On Topic Media PTY LTD. All Rights Reserved. Design by Vimu.com.
On Topic Media ZPages: Sydney |  Melbourne |  Brisbane |  London |  Birmingham |  Leeds     [ Advertise ] [ Contact Us ] [ Privacy Policy ]