Assigning an ID to an element
Any element in a document can be assigned a unique ID. Although element IDs can be used in a variety of ways, the two most common uses are:
How you assign an ID to an element depends on what the element is.
If the element is a…
|
Assign it a unique ID by doing this:
|
- paragraph
- heading
- list item
- preformatted block
- address
- term
- definition
|
- Place the insertion point inside the element.
- On the Home menu, go to Style, and then click Class/ID.
- In the ID box, type a unique ID.
|
- any other kind of element
|
- Select the element. (If the element cannot be directly selected in the document window, use the Tag SelectorThe Tag Selector appears on the left side of the status bar when the pointer is over the canvas in Edit mode. To select an element, click the corresponding tag in the Tag Selector. to select it.)
- On the Home menu, go to Style, and then click Class/ID.
- In the ID box, type a unique ID.
|
An ID must begin with a letter and may contain letters, numbers, hyphens, underscores, colons, and periods.
Related topics
Defining a style
Assigning an ID to an element