Title: Creating Web Pages with HTML, 3e
1New Perspectives on Creating Web Pages with HTML
- Tutorial 2 Adding Hypertext Links to a Web Page
2Tutorial Objectives
- Create hypertext links between elements within a
Web page - Create hypertext links between Web pages
- Review basic Web page structures
- Create hypertext links to Web pages on the
Internet - Distinguish between and be able to use absolute
and relative pathnames - Create hypertext links to various Internet
resources, including FTP servers and newsgroups
3Opening A Web Page
4Adding Hypertext Links
5Adding Hypertext Links
- 1. Type the headings into the HTML file
- 2. Mark each destination in file using an anchor.
- 3. Link the text you added in step 1 to your
anchors created in step 2.
6Creating Anchors
- Each anchor has its own anchor name, using the
name attribute i.e. - lta nameccgtClasseslt/agt.
- An anchor doesnt have to be text. You can mark
an inline image as an anchor. - Adding an anchor does not change your documents
appearance in any way.
7How an Anchor Works
8Creating Links
- To create a link to an anchor, use the ltagt tag.
- Use the href attribute, which is short for
Hypertext Reference, to indicate the location to
jump to. - href can refer to an anchor in the document or to
any resource anywhere on the Internet - the href attribute is case sensitive
- You link to an anchor using the anchor name
preceded by a pound () symbol - lta hrefgragtGradinglt/agt.
9Creating Links Continued
10Web Page Structures
- Storyboarding your Web pages before you create
links helps you determine which structure works
best for the type of information youre
presenting. - You want to ensure that readers can navigate
easily from page to page without getting lost.
11Linear Structures
12Augmented Linear Structure
13Hierarchical Structure
14Hierarchical Structure on AltaVista Web Page
15Combination of Linear and Hierarchical Structures
16Web Structures Continued
- The best time to organize a structure is when you
first start creating pages, when those pages are
small in number and more easily managed !
17Multipage Document with No Coherent Structure
18Creating Links Among Documents
19Linking to a Document
- To create a link to a document, use the same tag
with the href attribute - lta hrefcontact.htmgtContact melt/agt.
- In order for the browser to be able to locate and
open contact.htm, it must be in the same folder
as the document containing the link (chem.htm).
20HTML Code that Links to Other Documents
21Browser Displaying Links to Other Documents
22Linking to a Section of a Document
- To navigate to a specific location elsewhere in a
document, rather than the top, you can set
anchors and link to an anchor you create within
the document. - lta hrefhome.htminterestsgt View my interests
lt/agt
23Adding Links to Specific Locations in a Page
The pound symbol () in these tags (shown in red)
distinguishes the filename from the anchor name.
24Links in the Chemistry Page thatPoint to Anchors
in the Links Page
25Linking to Documents in Other Folders
- When referencing a file located in a different
folder than the link tag, you must include the
location, or path, for the file. - HTML supports two kinds of paths absolute paths
and relative paths.
26Absolute Pathnames
- An absolute pathname provides a precise location
for a file. - With HTML, absolute pathnames begin with a slash
(/) and are followed by a sequence of folders
beginning with the highest level folder and
proceeding to the folder that contains the file. - HTML also requires you to include the drive
letter followed by a vertical bar () - /C/tutorial.02/case/parks.htm.
27Folder Tree
28Relative Pathnames
- A relative path specifies the location for a file
in relation to the folder containing the current
Web document. - Unlike absolute pathnames, a relative pathname
does not begin with a slash. - To reference a file in a folder directly above
the current folder in the folder hierarchy,
relative pathnames use two periods (..)
../tutorial/chem.htm.
29Relative Pathnames Continued
- Relative pathnames make your hypertext links
portable. - Unlike absolute pathnames, If you move your files
to a different computer or server, the hypertext
links will stay intact.
30Linking to Documents on the Internet
- To create a hypertext link to a document on the
Internet, you need to know its URL. - lta href http//www.mwu.edu/course/info.htmlgtCourse
Informationlt/agt.
31Interpreting Parts of a Uniform Resource Locator
(URL)
32Link to Another Page on the Web
33Displaying Linked Documents in a New Window
- To force a document to appear in a new window,
instead of the main browser window, you would use
the target attribute in the href tag - lta hrefurl targetnew_windowgtHypertextlt/agt
- url is the URL of the page, and new_window is a
name assigned to the new browser window
34External Hyperlinks
- You can set up external hyperlinks to open in the
same browser window using the same target
attribute - If you want your external documents to be
displayed in their own browser window, you can
assign a unique target value for each hyperlink,
or you can assign the _blank keyword to the
target attribute - lta hrefurl target_blankgtHypertextlt/agt.
35Linking to File Transfer Protocol (FTP) Servers
- You can create links to other Internet resources,
such as FTP (File Transfer Protocol) servers. - FTP servers can store files that Internet users
can download, or transfer, to their computers - lta href ftp//ftp.microsoft.comgtMicrosoft FTP
serverlt/agt.
36Linking to Usenet News
- Usenet is a collection of discussion forums
called newsgroups that let users exchange
messages with other users on a wide variety of
topics. - The URL for a newsgroup is newsnewsgroup.
- To access the newsgroup
- lta hrefnewsalt.surfinggtGo to the surfing
newsgrouplt/agt.
37Linking to E-mail
- Many Web designers include their e-mail addresses
on their Web pages, so that users who access the
page can send feedback. - You can identify e-mail addresses as hypertext
links. - The URL for an e-mail address is
mailtoe-mail_address. - To create a link to the e-mail address
davis_at_mwu.edu, the following code would be
entered - lta hrefmailtodavis_at_mwu.edugtdavis_at_mwu.edult/agt
38Adding an Email Link
39Tutorial 2 Summary
- Learned how to work with hypertext links.
- Learned how to create anchors within a Web page.
- Created links to anchors.
- Created hyperlinks within a single document and
links to other Web pages. - Discussed creating hyperlinks to resources other
than Web pages, such as FTP sites, e-mail
addresses and Gopher servers.