Pseudo-classes are keywords which allow selection based on information that lies outside of the document tree or that cannot be expressed by other selectors or combinators. This information can be associated to a certain state (state and dynamic pseudo-classes), to locations (structural and target pseudo-classes), to negations of the former (negation pseudo-class) or to languages (lang pseudo-class). Examples include whether or not a link has been followed (:visited), the mouse is over an element (:hover), a checkbox is checked (:checked), etc.

Syntax

selector:pseudo-class { 
    property: value;
}

List of pseudo-classes:

Name | Description | –– | ———– |[:active](<https://www.w3.org/TR/css3-selectors/#the-user-action-pseudo-classes-hover-act>) | Applies to any element being activated (i.e. clicked) by the user. |[:any](<https://developer.mozilla.org/en-US/docs/Web/CSS/:any>) | Allows you to build sets of related selectors by creating groups that the included items will match. This is an alternative to repeating an entire selector. |[:target](<https://developer.mozilla.org/en-US/docs/Web/CSS/:target>) | Selects the current active #news element (clicked on a URLcontaining that anchor name) |[:checked](<https://www.w3.org/TR/css3-selectors/#checked>) | Applies to radio, checkbox, or option elements that are checkedor toggled into an “on” state. |[:default](<https://developer.mozilla.org/en-US/docs/Web/CSS/:default>) | Represents any user interface element that is the default among a group ofsimilar elements. |[:disabled](<https://www.w3.org/TR/css3-selectors/#enableddisabled>) | Applies to any UI element which is in a disabled state. |[:empty](<https://www.w3.org/TR/selectors/#empty-pseudo>) | Applies to any element which has no children. |[:enabled](<https://www.w3.org/TR/css3-selectors/#enableddisabled>) | Applies to any UI element which is in an enabled state. |[:first](<http://tympanus.net/codrops/css_reference/first>) | Used in conjunction with the @page rule, this selects the first page in aprinted document. |[:first-child](<https://developer.mozilla.org/en-US/docs/Web/CSS/:first-child>) | Represents any element that is the first child element of its parent. |[:first-of-type](<https://www.w3.org/TR/css3-selectors/#first-of-type-pseudo>) | Applies when an element is the first of the selected element typeinside its parent. This may or may not be the first-child. |[:focus](<https://www.w3.org/TR/css3-selectors/#the-user-action-pseudo-classes-hover-act>) | Applies to any element which has the user’s focus. This can be given by theuser’s keyboard, mouse events, or other forms of input. |[:focus-within](<https://developer.mozilla.org/en-US/docs/Web/CSS/:focus-within>) | Can be used to highlight a whole section when one element inside it is focused. It matches any element that the :focus pseudo-class matches or that has a descendant focused. |[:full-screen](<https://developer.mozilla.org/en-US/docs/Web/CSS/:fullscreen>) | Applies to any element displayed in full-screen mode. It selects the whole stackof elements and not just the top level element. |[:hover](<https://www.w3.org/TR/css3-selectors/#the-user-action-pseudo-classes-hover-act>) | Applies to any element being hovered by the user’s pointing device, butnot activated. |[:indeterminate](<https://www.w3.org/TR/css3-selectors/#indeterminate>) | Applies radio or checkbox UI elements which are neither checked norunchecked, but are in an indeterminate state. This can be due to anelement’s attribute or DOM manipulation. |[:in-range](<https://developer.mozilla.org/en-US/docs/Web/CSS/:in-range>) | The :in-range CSS pseudo-class matches when an element hasits value attribute inside the specified range limitations for this element.It allows the page to give a feedback that the value currently definedusing the element is inside the range limits. |[:invalid](<http://tympanus.net/codrops/css_reference/invalid/>) | Applies to <input> elements whose values are invalid according tothe type specified in the type= attribute. |[:lang](<https://www.w3.org/TR/css3-selectors/#lang-pseudo>) | Applies to any element who’s wrapping <body> element has a properlydesignated lang= attribute. For the pseudo-class to be valid, it mustcontain a valid two or three letter language code. |[:last-child](<https://developer.mozilla.org/en-US/docs/Web/CSS/:last-child>) | Represents any element that is the last child element of its parent. |[:last-of-type](<https://www.w3.org/TR/css3-selectors/#last-of-type-pseudo>) | Applies when an element is the last of the selected element type insideits parent. This may or may not be the last-child. |[:left](<http://tympanus.net/codrops/css_reference/left_pseudo-class/>) | Used in conjunction with the @page rule, this selects all the leftpages in a printed document. |[:link](<https://www.w3.org/TR/css3-selectors/#the-link-pseudo-classes-link-and-visited>) | Applies to any links which haven’t been visited by the user. |[:not()](<https://www.w3.org/wiki/CSS/Selectors/pseudo-classes/:not>) | Applies to all elements which do not match the value passed to(:not(p) or :not(.class-name) for example. It must have a value to bevalid and it can only contain one selector. However, you can chain multiple :not selectors together. |[:nth-child](<https://www.w3.org/TR/css3-selectors/#nth-child-pseudo>) | Applies when an element is the n-th element of its parent, where ncan be an integer, a mathematical expression (e.g n+3) or the keywordsodd or even. |[:nth-of-type](<https://www.w3.org/TR/css3-selectors/#nth-of-type-pseudo>) | Applies when an element is the n-th element of its parent of thesame element type, where n can be an integer, a mathematicalexpression (e.g n+3) or the keywords odd or even. |[:only-child](<https://developer.mozilla.org/en-US/docs/Web/CSS/:only-child>) | The :only-child CSS pseudo-class represents any elementwhich is the only child of its parent. This is the same as:first-child:last-child or :nth-child(1):nth-last-child(1),but with a lower specificity. |[:optional](<https://developer.mozilla.org/en-US/docs/Web/CSS/:optional>) | The :optional CSS pseudo-class represents any elementthat does not have the required attribute set on it. This allowsforms to easily indicate optional fields and to style them accordingly. |[:out-of-range](<https://developer.mozilla.org/en-US/docs/Web/CSS/:out-of-range>) | The :out-of-range CSS pseudo-class matches when an element has itsvalue attribute outside the specified range limitations for this element.It allows the page to give a feedback that the value currently defined using theelement is outside the range limits. A value can be outside of a range if it iseither smaller or larger than maximum and minimum set values. |[:placeholder-shown](<https://developer.mozilla.org/en-US/docs/Web/CSS/:placeholder-shown>) | Experimental. Applies to any form element currently displaying placeholder text. |[:read-only](<https://developer.mozilla.org/en-US/docs/Web/CSS/:read-only>) | Applies to any element which is not editable by the user. |[:read-write](<https://developer.mozilla.org/en-US/docs/Web/CSS/:read-write>) | Applies to any element that is editable by a user, such as <input> elements. |[:right](<http://tympanus.net/codrops/css_reference/right_pseudo-class>) | Used in conjunction with the @page rule, this selects all the right pages in aprinted document. |[:root](<https://developer.mozilla.org/en-US/docs/Web/CSS/:root>) | matches the root element of a tree representing the document. |[:scope](<https://developer.mozilla.org/en-US/docs/Web/CSS/:scope>) | CSS pseudo-class matches the elements that are a referencepoint for selectors to match against. |[:target](<https://developer.mozilla.org/en-US/docs/Web/CSS/:target>) | Selects the current active #news element (clicked on a URLcontaining that anchor name) |[:visited](<https://www.w3.org/TR/css3-selectors/#the-link-pseudo-classes-link-and-visited>) | Applies to any links which have has been visited by the user. |

The :visited pseudoclass can’t be used for most styling in a lot of modern browsers anymore because it’s a security hole. See this link for reference.