CSS1 Test Suite: 1.5 ID as selector


[Previous] [Next] [Section] [Contents] [Specification]
Last Updated: 11 May 1998

The style declarations which apply to the text below are:

#one {color: green;}
#1 {color: red;}
#a1 {color: green;}
P#two {color: blue;}
P#three {color: purple;}

This sentence should be green.

This sentence should be black, not red-- ID selectors cannot begin with digits in CSS1.

This sentence should be green.

This paragraph should be blue [ID="two"].

This paragraph should NOT be blue [ID="two"], because an ID should only be applied to a single element in the document. Subsequent uses of an ID after the first should be ignored; therefore, while the preceding paragraph should be blue, this one should not be blue.

This sentence should NOT be blue [PRE ID="two"].
This sentence should NOT be any color except black [PRE ID="three"].

This sentence should be green.

This sentence should be black, not red-- ID selectors cannot begin with digits in CSS1.

This sentence should be green.

This paragraph should be blue [ID="two"].

This paragraph should NOT be blue [ID="two"], because an ID should only be applied to a single element in the document. Subsequent uses of an ID after the first should be ignored; therefore, while the preceding paragraph should be blue, this one should not be blue.

This sentence should NOT be blue [PRE ID="two"].
This sentence should NOT be any color except black [PRE ID="three"].
  • This sentence should NOT be blue.
  • This sentence should NOT be purple.

[Previous] [Next] [Section] [Contents] [Specification]