Документация
HTML CSS PHP PERL другое
Addressing Web Pages
 
Previous Page
Table of Contents
Next Page

Addressing Web Pages

name of the file in the HRef attribute of the <a> tag. If you have many pages, you may want to put them in more than one folder for better organization. In that case, you still shouldn't use the full Internet address to link between them. You can use relative addresses, which include only enough information to find one page from another.

A relative address describes the path from one web page to another, instead of a full (or absolute) Internet address.

For instance, suppose you are creating a page named zoo.html in a directory folder named webpages on your hard drive. You want to include a link to a page named african.html, which is in a subfolder named elephants within webpages. The link would look like the following:

<a href="elephants/african.html">learn about african elephants.</a>

Watch Out!

The / forward slash is always used to separate directory folders in HTML. Don't use the \


The african.html page might contain a link back to the main zoo.html page:

<a href="../zoo.html">return to the zoo.</a>

The double dot (..) is a special code that indicates the folder containing the current folderin other words, the parent folder. (The ..

If you use relative addressing consistently throughout your web pages, you can move the pages to another folder, disk drive, or web server without changing the links. Or, using the example, everything will work as long as you always put african.html inside a subfolder named elephants.

Did you Know?

The general rule surrounding relative addressing (elephants/african.html) versus absolute addressing (http://www.takeme2thezoo.com/elephants/african.html) is that you should use relative addressing when linking to files that are stored together, such as files that are all part of the same web site. Absolute addressing should be used when you're linking to files somewhere elseanother computer, another disk drive, or, more commonly, another web site on the Internet.


Relative addresses can span quite complex directory structures if necessary; Hour 22, "Organizing and Managing a Web Site," offers more detailed advice for organizing and linking among large numbers of web pages.

Try It Yourself

You probably created a page or two of your own while working through Hour 2, "Create a Web Page Right Now." Now is a great time to add a few more pages and link them together:

  • Use a home page as a main entrance and central hub to which all of your other pages are connected. If you created a page about yourself or your business in Hour 2, use that as your home page. You also might like to make a new page now for this purpose.

  • On the home page, put a list of <a href> links to the other HTML files you've created (or plan to create soon). Be sure that the exact spelling of the filename, including any capitalization, is correct in every link.

  • On every other page, include a link at the bottom (or top) leading back to your home page. That makes it simple and easy to navigate around your site.

  • You may also want to include a list of links to sites on the Internet, either on your home page or on a separate hotlist page. People often include a list of their friends' personal pages on their own home page. (Businesses, however, should be careful not to lead potential customers away to other sites too quicklythere's no guarantee they'll come back!)

    By the Way

    will work unless he downloads all the pages or you've included full addresses.

    A good middle-of-the-road solution to this addressing problem involves including a link with the full address of your main home page at the bottom of every page, and using simple filenames or relative addresses in all the rest of the links.


    Remember to use only filenames (or relative addressing) for links between your own pages, but full Internet addresses for links to other sites.


Previous Page
Table of Contents
Next Page


 Приглашаем посетить сайты 
Мода Чехов Крылов Автомобили Лесков Салтыков-Щедрин Шмелев Сологуб Успенский CSS