DEV Community

Discussion on: Cool uses of the ::before and ::after pseudoelements

Collapse
 
defman profile image
Sergey Kislyakov

stackoverflow.com/questions/101817...

There are a bunch of good answers.

TLDR:

  • :: - pseudo-classes
  • : - pseudo-elements
Collapse
 
fluffy profile image
fluffy

I'm not really clear on the distinction of what one does vs. the other, from a practical standpoint, but at least that led me to this explanation of the difference which... seems that it's the other way around? :: seems to be pseudo-element and : seems to be pseudo-class.

I think what I got from that link is that :: specifies things that modify the DOM (i.e. a false element) whereas : specifies things that query against existing objects in the DOM (i.e. a false class), and so I at least kinda-sorta see why that would exist, but it also seems that user-agents are going to have to support : for the legacy pseudo-elements for quite some time. But this will help me out if I ever run into trouble with a new pseudo-element that a browser correctly distinguishes syntactically.