DEV Community

Discussion on: CSS decoded ::before and ::after

Collapse
 
afif profile image
Temani Afif

::before and ::after creates pseudo-elements that is the first and last child of the selected element respectively. --> The pseudo-element will not become "child" of selected element in a sense that we cannot select them using Child combinator .parent > * or Descendant combinator .parent *. also :last-child and :first-child don't apply to them.

To be more accurate, we should say "they behave as child" like said in the specification: w3.org/TR/css-pseudo-4/#generated-...

these pseudo-elements generate boxes as if they were immediate children of their originating element, with content as specified by content.

Collapse
 
ruppysuppy profile image
Tapajyoti Bose

Updated the wording of the phrase 👍