8/3/2015 - 4:41 PM

Pseudo elements and classes

Pseudo elements and classes

Pseudo Classes
(helps to further filter elements)
It enables the author of an stylesheet to differ between elements based on information that "lies outside of the document tree", for example the current status of a link (:active,:visited). Those aren't saved anywhere in the DOM, and there exists no DOM interface to access these options. (:nth-child)

Pseudo Elements
They don't filter elements, they basically filter content (::first-line,::first-letter) and wrap it in a virtual container, which the author can style however he want

Pseudo elements:

::before (insert content before the element)
::selection    (selected content in the browser, e.g. use a different highlight color)