Hyperlinks
Inserting Hyperlinks
Hyperlinks are links that take you to another page or web site. You create them by using the code below:
<a href="http://www.thepage.com">Name of link</a>
The link would appear as, Name of link
Open Links in a New Browser Window
If you don’t want people to leave your site completely when they click on links to other sites, you can set the link to open up a new window. The "target" attribute allows you to do this:
<a href="http://www…… "target="_blank">
Absolute vs Relative URLs
URL is another name for a web site address and stands for Uniform Resource Locator.
There are two different types of URLs you can use to link to various pages, absolute and relative.
Absolute URLs
Absolute URLs include the complete path to the file’s location, including the names of all the directories and subdirectories.
Let’s say you have a folder inside your web site's root directory called "music" and you want to link to a page inside the "music" folder called brahms.html.
The absolute URL is:
<a href="http://www.yoursite.com/music/brahms.html">Brahms</a>
Relative URLs
If you don’t want to ever have to worry about going back and editing your hyperlinks if your site structure changes then relative URLs are the way to go.
Relative URLs are more or less like shorthand that tells the browser to go backward one or more directories to find the file.
Let's say you're on the page we referenced above, brahms.html (located in the "music" folder) and you want to link back to the home page: (http://www.yoursite.com/index.html)
Using a relative URL, you would tell the browser to go back 1 directory by using the dot-slash method.
<a href="/../index.html">Home</a>
The two dots followed by a slash instructs the browser to go up 1 more level to get to the main (root) directory.
Changing the Hyperlink Colors
The default color for hyperlinks on an HTML page is blue, but you can change it to whatever color you'd like by using the link code inside the <body> tag. Here's an example:
<body link="green" vlink="yellow" alink="purple">
In the above example, hyperlinks will be green, links that have already been visited will be yellow and active links will be purple. (An active link is one that has just been clicked, so for a split second the link will change colors as the mouse activates it).
Creating Email Links
Creating email links are just as simple. All you need is the "mailto" function to get this to work properly:
<a href="mailto: This e-mail address is being protected from spambots. You need JavaScript enabled to view it ">Email Me</a>
Anchor Links
If you want to create a link that will take the visitor to another section of the same page (rather than a new page or site), then you can create an anchor link. There are two steps to this process:
1) First, go to the place in your HTML code where you want the anchor to go. This is the spot on the page that the browser will move to when a person clicks on the link.
Insert the code <a name="name1">This is the Text Where the Anchor Will Land</a> "name1" is just the name of the anchor I chose. You can all it anything you want.
2) Now to link to that section of the page, use the hyperlink code:
<a href="#name1">click here</a>
Now when your visitors click on that link, they will be taken to that section of the page.
Set as favorite
Bookmark
Email This
Hits: 268
Comments (0)

Write comment
| < Prev | Next > |
|---|
Donations
Donations are greatly appreciated and allow us to continue developing new extensions and templates.
