asp.net.ph

Skip Navigation LinksHome > Abakada: Back to Basics > Language References > CSS Properties > Pseudo-Classes

CSS Pseudo-Classes


Pseudo-classes permit selection based on information that lies outside of the document tree, or that cannot be expressed using the other simple selectors.

PropertyDescription
::afterDescribes generated content after an element’s content.
::beforeDescribes generated content before an element’s content.
::first-letterRepresents the first letter of an element.
::first-lineDescribes the contents of the first formatted line of an element.
:activeApplies while an element is being activated by the user.
:checkedApplies to elements that have the selected and checked attributes.
:disabledRepresents user interface elements that are in a disabled state.
:emptyRepresents an element that has no children.
:enabledRepresents user interface elements that are in an enabled state.
:first-childRepresents an element that is first in a list of siblings.
:first-of-typeRepresents an element that is the first sibling of its type.
:focusApplies while an element has the focus (accepts keyboard or mouse events, or other forms of input).
:hoverApplies while the user designates an element with a pointing device, but does not necessarily activate it.
:langRepresents an element based on its language.
:last-childRepresents an element that is last in a list of siblings.
:last-of-typeRepresents an element that is the last sibling of its type.
:linkApplies to links that have not yet been visited.
:not()Represents elements that do not match a given list of selectors.
:nth-child()Selects child elements based on their index.
:nth-last-child()Selects child elements based on their index, counting from the end.
:nth-last-of-type()Selects elements of the same type (tag name), based on their index counting from the end.
:nth-of-type()Selects elements of the same type (tag name), based on their index.
:only-childRepresents an element without any siblings.
:only-of-typeRepresents an element that has no siblings of the same type (tag name).
:rootRepresents an element that is the root of the document.
:targetSelects the target element of the document.
:visitedApplies once the link has been visited by the user.

External reference: 5.11. Pseudo-classes

See Also

Style Sheet Basics   Using StyleSheets   W3C Cascading Style Sheet Specification



Check out related books at Amazon

© 2025 Reynald Nuñez and asp.net.ph. All rights reserved.

If you have any question, comment or suggestion
about this site, please send us a note