Chapter 5 - Selectors - 5.9 ID selectors
Go to the relevant page of the specification.
- c15-ids-000
-
ID as selector
- c15-ids-001
-
ID as selector
- id-000
-
Selectors: ID selectors
Browsers should apply each rule to the elements which have the specified ID - id-001
-
Selectors: ID selectors with universal selector
Browsers should apply each rule to the elements which have the specified ID - id-selector-001
-
Simple ID selectors
ID selector matches appropriate element. - id-selector-002
-
ID selector syntax - Begins with hyphen
Identifier selectors starting with a hyphen are valid. - id-selector-004 (invalid)
-
Invalid ID selector syntax - white space between # and id
White space is not allowed between # and identifier for selector. - id-selector-005 (invalid)
-
Invalid ID selector syntax - Begins with numerals
Identifier selectors are invalid if it begins with a numeral. - id-selector-006
-
Simple ID selectors specificity over attribute selectors
ID selectors trump attribute selectors in specificity.