Linking to Other Web Pages
In the previous two hours you learned how to create an HTML page with some text on it. However, to make it a "real" Web page you need to connect it to the rest of the World Wide Webor at least to your own personal or corporate web of pages.
This hour shows you how to create hypertext linksthose words that take you from one Web page to another when you click them with your mouse. You learn how to create links that go to another part of the same page in Hour 6, "Advanced Text Formatting and Links."
Although the same HTML tag you study in this hour is also used to make graphics images into clickable links, graphical links aren't explicitly discussed here. You'll find out about those in Hour 9, "Putting Graphics on a Web Page."
Linking to Another Web Page
The tag to create a link is called <a>, which stands for anchor. (Don't even try to imagine the thought process of the person who came up with this strange name for a link between pages. As Thomas Carlyle once said, "The coldest word was once a glowing new metaphor.") You put the address of the page to link to in quotes after href=, like the following:
<a href="http://netletter.com/dicko/index.htm">click here!</a>
This link displays the words click here! in blue with an underline. When a user clicks those, she would see the Web page named index.htm, which is located in the dicko folder on the Web server computer whose address is netletter.comjust as if she had typed the address into the Web browser by hand.
href stands for hypertext reference and is called an attribute of the <a> tag. You'll learn more about attributes in Hour 5, "Text Alignment, Lists, and Special Characters."
Note - As you might know, you can leave out the http:// at the front of any address when typing it into most Web browsers. You cannot leave that part out when you type an address into an <a href> link on a Web page, however.
There are XHTML standards for the form that tag attributes can have. All attribute names must be in lowercase and the values assigned to them must always be surrounded by quotes. Therefore, an anchor tag of the form
<a HREF="http://www.someplace.com">Click me</a>
would not satisfy the standards because HREF is capitalized. The text inside the quotes is an example of a literal string, something that is no more or less than the sequence of characters inside the quotes, so XHTML capitalization standards don't apply. To be functional, the reference in the quotes must conform to the standards of URL construction, which are different from those of XHTML. Case differences in URLs are sometimes ignored, other times automatically changed, and sometimes considered to denote true differences. To be on the safe side, you should always assume the latter is true and be sure to match capitalization exactly.
Tip - One thing you can often leave out of an address is the actual name of the HTML page. Most computers on the Internet automatically pull up the home page for a particular address or directory folder. For example, you can use http://netletter.com to refer to the page located at http://netletter. com/index.htm because my server computer knows index.htm is the page you should see first. However, most is not all, so if you get an error noting that the page is unavailable, try including the full name of the page.
Figure 3.1 includes a number of <a> tags, which show up as underlined links in Figure 3.2. For example, clicking the words Alloway, New Jersey in Figure 3.2 will take you to the page located at http://www.accsyst.com/cow.html, as shown in Figure 3.3.
Tip - You can easily transfer the address of a page from your Web browser to your own HTML page by using the Windows or Macintosh clipboard. Just highlight the address in the Location, Address, Bookmark Properties, or Edit Favorites box in your Web browser, and select Edit, Copy (or press Ctrl+C). Then type <a href=" and select Edit, Paste (Ctrl+V) in your HTML editor.