I was just wondering if I should use ":" or "::" when using :(:)before and :(:)after. I am wondering if there is a difference.
Asked
Active
Viewed 579 times
-1
-
Did you see any difference when you changed from 1 to the other? – takendarkk Dec 01 '16 at 20:04
-
Did you search for this? I imagine this would be extremely easy to find information on. – Carcigenicate Dec 01 '16 at 20:04
-
1`::before` is correct, `:before` exists for backwards-compatibility. – Niet the Dark Absol Dec 01 '16 at 20:05
1 Answers
3
The ::before notation (with two colons) was introduced in CSS3 in order to establish a discrimination between pseudo-classes and pseudo-elements. Browsers also accept the notation :before introduced in CSS 2.
Source: https://developer.mozilla.org/en-US/docs/Web/CSS/::before
As before is a pseudo ELEMENT and not a pseudo CLASS (like :hover) two colons is better (thus following the CSS3 standard).

Mr. Hugo
- 11,887
- 3
- 42
- 60