HTML and CSS Reference
In-Depth Information
Creating a Semantic Link
The text of a hypertext link should always describe to users the type of document that the
link opens. You can also use the rel attribute to indicate the type of document that a link
calls. For example, in the links to the site's home page, Gerry could insert the following
rel attribute, setting its value to fi rst to indicate that the home page is the fi rst document
in the CAMshots Web site:
<a href=”home.htm” rel=”fi rst”>Home Page</a>
A hypertext link containing the rel attribute is called a semantic link because the tag
contains information about the relationship between the link and its destination. This
information is not intended for the user, but for the browser. For example, a browser
could be set up to mark the fi rst Web page in a site with a special icon or to provide
scripts that allow quick access to a site's fi rst page.
Although the rel attribute is not limited to a fi xed set of values, the specifi cations for
HTML and XHTML include a proposed list of special values. Figure 2-46 shows some of
these proposed relationship values.
Figure 2-46
Proposed values for the rel attribute
rel Attribute
Link To …
An alternate version of the document
A collection of historical documents
Information about the author of the document
An external document
The first document in a selection
A help document
An index for the document
The last document in a selection
Copyright information for the document
The next document in a selection
The previous document in a selection
A search tool for the selection
A document that should be shown in the browser's sidebar
An external style sheet
HTML 4.01 and XHTML also support the rev attribute to describe the reverse relation-
ship: how a linked document views the current document. For example, if you're linking
to the Glossary page from the home page, the reverse relation is fi rst (because that is how
the Glossary page views the home page). The HTML code would be
<a href=”glossary.htm” rel=”glossary” rev=”fi rst”>Glossary</a>
The rev attribute is not supported in HTML5.
At this point, Gerry decides against using the rel and rev attributes on his Web site.
However, he'll keep them in mind as an option as his Web site expands in size and
Search WWH ::

Custom Search