11/5/09

HTML - Beyond the Basic Page - The "a" Tag

In another article we learned the basic structure and code to create a simple web page. Several tags were introduced without much detail. Here for a quick review is a basic web page with each of the following words (tags) contained by brackets (I can't put brackets around them or they won't show up on the page. This is an opening bracket < and this is a closing bracket >). title is an opening tag and /title is a closing tag.

html
head
title
/title
/head
body
/body
/html
When you're making web pages, sooner or later you'll want to send your viewer to another page (or another part of the same page). Your tool to accomplish this is the a /a tag. The basic tag includes the destination page, letters (or an image) for the user to click and an end tag (brackets go around the letters in bold). a href="destination.html" click here /a 'destination.html' is where your visitor will be sent and 'click here' is what your visitor will see.
You may need to study that a little because I know it can be confusing at first. There are three parts-
-- the opening tag-- a href="somewhere.html" (substitute the name of your destination page)
-- the letters (or image) the user will click- 'click here' (often used but not considered good form)
-- the closing tag-- /a
If you have a basic web page created, make a duplicate (save it as two.html and put some other text between the body tags). Then create an a tag for it. If you don't already have a basic page, copy the code above to notepad (or any simple word processor) put brackets around each group of letters and save it as one.html
OK, Here we go. Open one.html (or your basic page) in notepad (or any basic word processor).
Between the body tags (all on one line) put the following--
a href="two.html" go to two /a
With brackets around the parts that are in bold type. Then save this. Now when you open (double click) one.html, it will open in the browser and you will see the words "go to two". When you click on those words, your new page (two.html) will open in the browser (if you didn't put anything between the body tags it will be blank). Then if you click the browser 'back' button you'll go back to page one.
Congratulations. Cool, huh. If it doesn't work the first time, go back and study the code a little more. Every letter, quote and bracket must be included and in the right place.

No comments:

Post a Comment