Full-stack Web Technologies

CHAPTER 1
Pseudo Classes and Elements

Pseudo-elements and pseudo-classes refer to elements and classes that we don't have to mark ourselves but that the browser provides by itself, and which reveal nodes that are created automatically or contain information about the state of some element:

Pseudo-elementDescription
::beforeEmpty element just before some element
::afterEmpty element just after some other element
::first-letterThe first letter in a paragraph
::first-lineFirst line in a paragraph
Pseudo-classDescription
:rootThe root of the document tree
:emptyHas no children (like <p></p>)
:first-childFirst child of its parent
:last-childLast child of its parent
:nth-child(n)Is the child at position n
:visitedIf a link was visited
:focusIf an element is in focus
:hoverIf the mouse is over an element
:activeIf an element is being clicked