6.5. Document Relationships

There are a host of other attributes that you can add to your anchor tags to describe the form of the target being linked to, the relationship between the current document and the target, and more.

The following table lists these descriptive attributes and their possible values.

6.5.1.

6.5.1.1. Link Target Details
AttributeMeaningValue(s)
charsetThe character encoding of the targetchar_encoding for example, "ISO 8859-1"
hreflangThe base language of the targetlanguage_code for example, "en-US"
relThe relationship between the current document and the targetalternate

designates

stylesheet

start

next

prev

contents

index

glossary

copyright

chapter

section

subsection

appendix

help

bookmark
revThe relationship between the target and the current documentalternate

designates

stylesheet

start

next

prev

contents

index

glossary

copyright

chapter

section

subsection

appendix

help

bookmark
typeThe MIME type of the targetAny valid MIME type

An example of how the relationship attributes (rel, rev) can be used is shown in the following code snippet:

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
   "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html>
<head>
<title>Chapter 10</title>
</head>
<body>
<p><a href="contents.html" rel="chapter" rev="contents">Table
of Contents</a></p>
<p><a href="chapter 9.html" rel="next" rev="prev">Chapter
9</a></p>
<p><a href="chapter 11.html" rel="prev" rev="next">Chapter
11</a></p>
...

The anchor tags define the relationships ...

Get Web Standards Programmer's Reference: HTML, CSS, JavaScript®, Perl, Python®, and PHP now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.