HTML and CSS Reference
In-Depth Information
Using the
link
Element
Another way to add a hypertext link to your document is to add a
link
element to the
document's head with the syntax
<link href=”
url
” rel=”
text
” rev=”
text
” target=”
window
” />
where the
href
,
rel
,
rev
, and
target
attributes serve the same purpose as in the
<a>
tag. You've already used the
link
element to link your Web pages to external style
sheets, but you can use it to link to other types of documents as well. For example, to
use the
link
element to create semantic links to the three pages of Gerry's Web site, you
could add the following link elements to the
head
element of each document:
<link rel=”fi rst” href=”home.htm” />
<link rel=”help” href=”tips.htm” />
<link rel=”index” href=”glossary.htm” />
Because they are placed within a document's head,
link
elements do not appear
as part of the Web page. Instead, if a browser supports it, the links can be displayed in
a browser toolbar. The advantage of the
link
element used in this way is that it places
the list of links outside of the Web page, freeing up page space for other content. Also,
because the links appear in a browser toolbar, they are always easily accessible to users.
Currently, Opera is one of the few browsers with built-in support for the
link
element.
Third-party software exists to provide this support for Internet Explorer and Firefox.
Because no single list of relationship names is widely accepted, you must check with
each browser's documentation to fi nd out what relationship names it supports. Until
semantic links are embraced by more browsers, you should use them only if you dupli-
cate that information elsewhere on the page.
Working with Metadata
Gerry is happy with the work you've done on the design for his CAMshots Web site. Now
he wants to start working on getting the site noticed. When someone searches for “digital
photography tips” or “camera buying guide,” will they fi nd Gerry's Web site? There are
thousands of photography sites on the Web. Gerry knows he needs to add a few extra
touches to his home page to make it more likely that the site will be picked up by major
search engines such as Yahoo! and Google.
Optimizing a Web site for search engines can be a long and involved process. For the
best results, Web authors often turn to
search engine optimization
(
SEO
) tools to make
their sites appear more prominently in search engines. Because CAMshots is a hobby
site, Gerry does not want to invest any money in improving the site's visibility; but he
would like to do a few simple things that would help.
Using the
meta
Element
To be noticed on the Web, a site needs to include information about itself for search
engines to read and add to their search indices. Information about a site is called
metadata
. You can add metadata to your Web pages by adding a
meta
element to the
document head. In the last tutorial, you saw how to use the
meta
element to store infor-
mation about the character set used by the page; but you can also use it to store other
information about the document. The syntax of the
meta
element is
<meta name=”
text
” content=”
text
” scheme=”
text
” http-equiv=”
text
” />
where the
name
attribute specifi es the type of metadata, the
content
attribute stores the
metadata value, the
scheme
attribute defi nes the metadata format, and the
http-equiv
attribute is used to attach metadata or commands to the communication stream between