Next / Previous / Contents / TCC Help System / NM Tech homepage

15.4. The id attribute: Assigning a unique identifier to an element

You can attach a unique identifier to any element on your page by giving that element an id attribute. The value must conform to the general XML rules for identifiers: the first character must be a letter, and any additional characters can be letters, digits, underbars (_), hyphens (-), or periods (.).

For example, suppose are using a CSS stylesheet and you have a paragraph that contains a capsule biography of Frank Zappa. You can give this paragraph a unique identifier of “fz” by using the start tag “<p id='fz'>”. Then you can specify the appearance of this specific paragraph using the CSS selector “p#fz”.

The value of each id attribute in a document must be unique. You may not have two elements in the same document, for example, with attribute “id='g14.7'”.