Skip to main content
|
|
Search crustysocks.com:
|
Mobile/cellular phone accessories and handsets
Conspiracy theory books and DVD's
Become a link partner
|
Ok, so we now have our basic web page layout. What we want to do next is add content with "links, headings, lists, images and some other little touches". In this section we're going to deal with "links", which is a way of allowing users to go to other pages, other web sites or maybe to a different section of the same page. We do this with the following code:
<A HREF="THE NAME OF THE FILE YOU'RE LINKING TO.HTML">Put text here refering to what the link is.</A>
Firstly, the part where it says "Put text here refering to what the link is", is what the user sees and would click on to activate the link. So, if you've done a link called "profile", then you would put something like:
<A HREF="PROFILE.HTML">Click here to view my profile.</A>
Also, in the example above, the part where it says "THE NAME OF THE FILE YOU'RE LINKING TO", can be substituted with another web sites address, for example: http://www.google.co.uk, so it would look like:
<A HREF="http://www.google.co.uk">Google.co.uk</A>
PLEASE NOTE: Notice the space between the "A" and the "HREF", this is very important and code should be written correctly.
Some other things to remember are:
So using the examples above and the idea that you have a certain file name in a certain folder, let's look at an example. You're in your "home page (index.html)" page and you want to link to another page named "HOBBIES.HTML", which is a page you've written about your hobbies. Remember your "index.html" page is outside of the "HTML" folder...and the "HOBBIES.HTML" page is in the "HTML" folder. We would write:
<A HREF="HTML/HOBBIES.HTML">Click here to read about my hobbies.</A>
All we've done is add the prefix, "HTML/". This is what we call the path name, which is telling the browser where the file it's linking to is. Another example is:
<A HREF="HTML/ABOUTME.HTML">About me.</A>
which is a link to a page called "ABOUT ME", which is located in your "HTML" folder. Keep this in mind when doing any kind of link, it's very important you get the path name and case correct.
When linking to a section of the same page, it's much like a normal link, however, instead of having a file name to link to, you create one on the page for it to go to. This is called an "anchor". For example, you're at the top of your page and you want to create a link called"skip to main content". This will, as it says, take you to the main content of your page. We do this with the following codes:
Put this as the link:
<A HREF="#SKIP TO MAIN">Skip to main content.</A>
and put this where the main content of your page starts:
<A NAME="SKIP TO MAIN"</A>
So, when the user clicks on the link called "SKIP TO MAIN CONTENT", it will take them to the area of the page where you place the code:
<A NAME="SKIP TO MAIN"</A>
Notice the only difference on the first code is that I put a "#" symbol and it didn't have an extension, I just called it what I wanted. The second code is an invisible code (to the user) that the first one is linking to. On this one the only difference is the "HREF" is substituted with "NAME" and there are no words needed for the users to see or click on. Try it out, as this can be a really useful tool for jumping to specific sections of a page. Best of luck!
Add this page to:
Please contact us with any enquiries or comments via our
contact form
or if you prefer to e-mail direct, you can at:
enquiries@crustysocks.com
For any technical problems or accessibility issues you may be experiencing, please use the "contact form" link above or e-mail the webmaster at:
webmaster@crustysocks.com
For live Skype chat or instant messaging:
Skype status: Call us!
or
send us an IM!
Not got Skype? Find out more and download:
click here!