id attribute

Type:string
Inherited:no
See:class

The id attribute allows an element to be uniquely referenced within the document. Every element in the document (theoretically including elements in the head, although this isn't usual except for macro elements) may have an id attribute specified, which is the unique "name" given to the element.

This id may then be referenced in a stylesheet (to assign properties to that element) or in an action (to jump to that element in the document).

This example sets the color for the paragraph by setting the paragraphs ID

<pdf>
  <head>
    <style>
      #mainparagraph { color:red }
    </style>
  </head>
  <body>
    <p id="mainparagraph"> This is in red </p>
  </body>
</pdf>

This example shows how to jump to a specific element in the document by using it's ID

<h1 id="chapter1">Chapter 1</h1>
<p> Contents of chapter 1 here </p>

<a href="#chapter1">Jump to Chapter 1</a>