HTML and CSS Reference
In-Depth Information
Table 3-4 <a> Tag Attributes and Functions (continued)
Attribute
Function
type
Specifies the content type (also known as media types or MIME types) of the linked page
or file to help a browser determine if it can handle the resource type. Examples of content
types include text/html, image/jpeg, video/quicktime, application/java, text/css, and text/
javascript.
Before creating a link, be sure you know the URL or name of the file to be
linked and the text that will serve as the clickable word or phrase. The words should be
descriptive and tell the Web page visitor the purpose of the link. For the Underwater
Tours by Eloise home page, the text link is a phrase in a paragraph at the bottom of the
Web page.
To Add a Text Link to Another Web Page Within the Same Web Site
The Underwater Tours by Eloise home page includes a text link to the Sample Photographs Web page, which
is part of the same Web site. The following step illustrates how to add a text link to another Web page within the
same Web site.
1
the left of the s in the
word sample on line 19.
Click immediately to
href
stands for
hypertext
reference
start
anchor
tag <a>
link to samplephotos
.html Web page
<a href=
”samplephotos
.html”> to
start the link,
setting the
Web page
samplephotos.html as
the linked Web page.
Type
line 19
end anchor
tag </a>
the right of the s in
photographs on line 19.
Type </a> to close the
link (Figure 3-13).
Click immediately to
Figure 3-13
What is the href
attribute for?
The href stands for “hypertext reference”
and precedes the URL of the destination Web page.
How will I know if my text is a link when it is displayed in the browser?
In the browser, the mouse pointer turns into a pointing finger where there is a link. Also, as the default, text used as
a link will be blue and underlined. You can change the color and style of a link, and you do that later in the chapter.
What happens if I forget to insert the </a> tag on a link?
A text link without the </a> tag will not display correctly in the browser. If you forget to use the </a> tag to end this text
link, all of the text beyond the <a href=“”> tag will serve as that link. In this example, all of the text that follows the s in
sample will link to the samplephotos.html Web page, which is certainly not what you want.
 
Search WWH ::




Custom Search