I've noticed that both :
and ::
work when marking up pseudo elements in CSS. I'm sure there is some semantic difference between the two, no? I'm not really seeing it.
Asked
Active
Viewed 184 times
3

sircodesalot
- 11,231
- 8
- 50
- 83
-
Also see http://stackoverflow.com/questions/8069973/what-is-the-difference-between-a-pseudo-class-and-a-pseudo-element-in-css – Sourabh May 25 '13 at 05:18
1 Answers
5
From the CSS3 selector specification section on pseudo-elements:
This
::
notation is introduced by the current document in order to establish a discrimination between pseudo-classes and pseudo-elements. For compatibility with existing style sheets, user agents must also accept the previous one-colon notation for pseudo-elements introduced in CSS levels 1 and 2 (namely,:first-line
,:first-letter
,:before
and:after
). This compatibility is not allowed for the new pseudo-elements introduced in this specification.

Rory O'Kane
- 29,210
- 11
- 96
- 131

Kai
- 9,038
- 5
- 28
- 28
-
Background information from the spec: “A [pseudo-class](http://www.w3.org/TR/css3-selectors/#pseudo-classes) always consists of a "colon" (`:`) followed by the name of the pseudo-class and optionally by a value between parentheses.” “A [pseudo-element](http://www.w3.org/TR/css3-selectors/#pseudo-elements) is made of two colons (`::`) followed by the name of the pseudo-element.” – Rory O'Kane May 25 '13 at 04:11