id Attribute

The id attribute is used to give a particular element a unique identifier. It is used for a wide variety of purposes: internal links, some image maps, id selectors, and, in JavaScript, to access elements with the document.getElementById(). See w3schools for complete rules. Know the following (I don't care about ':' and '.' in ids):

Examples:

As it appears in an element

<h1 id="mainHeading">Main Heading</h1>

<p id="paragraph22"> .. </p>

Good Examples

id="main"
id="paragraph2"
id="intro_paragraph"
id="Bear-Map02"

Incorrect ids (click them for reason)

id="_main_"
id="#main"
id="2ndParagraph"
id="--intro--"
id="intro paragraph"

Back to Knowledge Dump