+ 2
What is the uses of :: in CSS?
2 Answers
+ 4
The double colon replaced the single-colon notation for pseudo-elements in CSS3. This was an attempt from W3C to distinguish between pseudo-classes and pseudo-elements.
example:
p::first-line {
color: red;
}
versus
p:first-line {
color: red;
}
Both segments of code will work.
For backward compatibility, the single-colon syntax is acceptable for CSS2 and CSS1 pseudo-elements.
+ 1
For pseudo-elements Ex.: ::before and ::after