Description
An ID selector matches an element that has a specific id attribute value. Since idattributes must have unique values, an ID selector can never match more than one element in a document.
In its simplest form, an ID selector looks like this:
#navigation {
? declarations
}
This selector matches any element whose id attribute value is equal to"navigation". In this selector, which is equivalent to *#navigation, the universal selector is implied. The universal selector is often omitted in cases like this.
Of course, it’s possible to use a type selector with an ID selector, but it’s rarely necessary, since an ID uniquely identifies an element. Here’s an example that only matches an unordered list element with an id attribute value that’s equal to"navigation":
ul#navigation {
? declarations
}
Whitespace characters shouldn’t appear between the type selector and the ID selector.
Example
This example selector matches any element whose id attribute value is equal to"breadcrumbs":
#breadcrumbs {
? declarations
}















