Sams Teach Yourself HTML, CSS & JavaScript Web Publishing in One Hour a Day

(singke) #1
ptg16476052

Creating Links 93

6


was revealed after arrangements had been made for her son, Nero, to
succeed as Emperor.


Go back to Main Menu





Make sure that both of your files are in the same directory or
folder. If you haven’t called them menu.html and claudius.html,
make sure that you take note of the filenames because you’ll
need them later.

CAUTION

Create a link from the menu file to the claudius file. Edit the menu.html file, and put the
cursor at the following line:


  • Claudius

  • You’ll want to nest the tag inside the existing

  • tag. First, put in the link tags
    themselves (the
    and tags) around the text that you want t o use as the link:


  • Claudius

  • Now add the URL that you want to link to as the href part of the opening link tag. In
    this case the URL is simply a pointer to the other file you’ve created. Enclose the name
    of the file in quotation marks (straight quotes ["], not curly or typesetter’s quotes [“]),
    with an equal sign between href and the name. Filenames in links are case sensitive, so
    make sure that the filename in the link is identical to the name of the file you created.
    (Claudius.html is not the same file as claudius.html; it has to be exactly the same
    case.) Here I’ve used claudius.html; if you used different files, use those filenames.


  • Claudius

  • Now start your browser, select Open File (or its equivalent in your browser), and open
    the menu.html file. The paragraph you used as your link should now show up as a link
    that is in a different color, underlined, or otherwise highlighted. Figure 6.3 shows how it
    looked when I opened it.


    Now when you click the link, your browser should load and display the claudius.html
    page, as shown in Figure 6.4. ▼

    Free download pdf