::before vs :before
Note the double-colon ::before versus the single-colon :before. Which one is correct?
Technically, the correct answer is ::before. But that doesn’t mean you should automatically use it.
The situation is that:
- double-colon selectors are pseudo-elements.
- single-colon selectors are pseudo-selectors.
::before is definitely a pseudo-element, so it should use the double colon.
The distinction between a pseudo-element and pseudo-selector is already confusing. Fortunately, ::after and ::before are fairly straightforward. They literally add something new to the page, an element.…
The post ::before vs :before appeared first on CSS-Tricks.




