What’s the Difference Between “:before” and “::before”?
When using or researching CSS pseudo-elements, you may have come across different syntax for the :before
and :after
pseudo-elements, specifically in the form of a preceding double colon, instead of the traditional single colon. This seems a little confusing at first, but there’s actually a pretty simple explanation.
I had assumed that there would be some difference in the way each functioned, but that’s not the case, as the short and long answers below make clear.