|
A look at Hypertext Markup Language (HTML) Part 4 |
|
Basic Text Formatting, Images and Links: Links:
|
|||||||
|
Links are no more difficult than addressing a letter. The tag for them is <a>. There are several kinds of links, depending upon their purpose.
<a href="mailto:"[email protected]">Email me! (or whatever text you prefer)</a> is how you would write a link to allow someone to send you an email. If you were to click on the link "Email me!", your browser would open up a message page to send me an email.
<a href="http://www.website.com"> Website.com</a> is how you write a link to another page on the Web. The "http://" must be included or the link may not work. If you want the new page to come up in a new window, the link would be <a href="http://www.website.com" target="_blank">Website.com</a>
There is one other important link, the same-page, or anchor link. Have you ever read a very long page, gotten to the bottom of it, only to have to scroll to the top again to find the links to the next page? Or a long page where the information you want is at the bottom, or somewhere in the middle? Anchor links resolve that annoyance. The anchor link has two parts to it, the anchor and the link. The anchor is placed at the point to which another link will refer. For example, scroll down to the bottom of this page. Click on the link "Resume". Then come back here. That's an anchor link. The link "Top" will take you back to the top of this page. Scroll down, and try it.
Did you find the link that brings you back here? Good. Now, the instructions for creating anchor links. At the point where you want the link to end, the anchor point, type <a name="anchorname"></a>. Give each anchor on your page a different name. You don't need to have text to indicate the anchor point, either. When you get to the point where you're ready to place the link, the link will be written <a href="#anchorname">Link Name</a>. The Pound sign indicates that the link is to an anchor on a page. Your anchor doesn't have to be on the same page as the link. If that's the case, such as the 'continue' link at the top of this page, your anchor tag will read <a href="http://www.url.com/#anchorname">. The links used on this page are: <a name="resume1">, <a name="top">, <a name="resume2">. The links are <a href="html5.htm#resume"> and <a href="html5.htm"> When you put your cursor (mouse) over the link, at the bottom left hand corner of your screen, you will see the link as I have written it. Links are that simple.
And, with that said, we have two tags to close, and our page is done. </body> tells the browser that the body of the page is complete. Sometimes, there will be images used as links, and the image maps for them (that's for another time, I'm afraid. It can get confusing, and not all pages require image maps), and that map information will be placed here. </html> tells the browser that the end of the HTML document has been reached
| |||||||