Knowledge baseExam Center
ENEnglish
Choose language13

CKTIS / CSS

Knowledge base — CSS

Programming syntax, operators and concepts. Find an explanation, explore an example and return to learning.

Entries: 899

CSS

:has() — relational pseudo-class

:has() selects an element based on its relationships with other elements. Its arguments are relative selectors evaluated against the element being tested.

Intermediate · CSS modules; structured CSSWG indexes reconciled with pinned MDN BCD; Chromium 152 scope gate, per-example verification still required
CSS

::highlight() — styling custom text highlights

The ::highlight() pseudo-element styles text ranges registered through the CSS Custom Highlight API without adding wrapper elements. CSS defines the appearance, while JavaScript creates the ranges and registers the highlight under a name.

Intermediate · CSS modules; structured CSSWG indexes reconciled with pinned MDN BCD; Chromium 152 scope gate, per-example verification still required
CSS

:host — styling a Shadow DOM host

The :host pseudo-class lets a stylesheet inside Shadow DOM select its host element. Outside a shadow-tree context, it matches nothing.

Intermediate · CSS modules; structured CSSWG indexes reconciled with pinned MDN BCD; Chromium 152 scope gate, per-example verification still required
CSS

:host() — conditionally selecting a Shadow DOM host

The :host() pseudo-class selects a Shadow DOM host element when it matches the selector inside the parentheses. It operates in the context of that host’s shadow tree, letting host styles depend on a class, attribute, or another condition.

Intermediate · CSS modules; structured CSSWG indexes reconciled with pinned MDN BCD; Chromium 152 scope gate, per-example verification still required
CSS

:hover — the pointer hover pseudo-class

The :hover pseudo-class matches an element designated with a pointing device, such as a mouse pointer, without requiring a click. It lets you change appearance while pointing, but must not be the only way to access important content or functionality.

Basic · CSS modules; structured CSSWG indexes reconciled with pinned MDN BCD; Chromium 152 scope gate, per-example verification still required
CSS

ID selector — #id

The #id selector matches an element by its identifier. Learn its syntax, specificity, and what ID uniqueness means for matching.

Basic · CSS modules; structured CSSWG indexes reconciled with pinned MDN BCD; Chromium 152 scope gate, per-example verification still required
CSS

:indeterminate — indeterminate-state pseudo-class

The :indeterminate pseudo-class matches controls in an indeterminate state: appropriately configured checkboxes, radio buttons in a group with no selection, and progress elements without a value attribute. It does not simply mean “unchecked”.

Intermediate · CSS modules; structured CSSWG indexes reconciled with pinned MDN BCD; Chromium 152 scope gate, per-example verification still required
CSS

:in-range — a value within permitted bounds

The :in-range pseudo-class selects controls with range limitations that violate neither the lower nor the upper bound. It does not mean that the field satisfies every validity constraint.

Basic · CSS modules; structured CSSWG indexes reconciled with pinned MDN BCD; Chromium 152 scope gate, per-example verification still required
CSS

::interest-button — an additional interest indicator

A pseudo-element providing an additional way to show interest in an element, for example to reveal supplementary information.

Advanced · CSS modules; structured CSSWG indexes reconciled with pinned MDN BCD; Chromium 152 scope gate, per-example verification still required
CSS

:interest-source — the current interest source

The :interest-source pseudo-class selects a source the user is currently showing interest in, not every element with interestfor.

Intermediate · CSS modules; structured CSSWG indexes reconciled with pinned MDN BCD; Chromium 152 scope gate, per-example verification still required
CSS

:interest-target — target of active interest

The :interest-target pseudo-class selects a target associated with a source in which the user is currently showing interest. The association alone is insufficient.

Intermediate · CSS modules; structured CSSWG indexes reconciled with pinned MDN BCD; Chromium 152 scope gate, per-example verification still required
CSS

:invalid — an element failing validation constraints

The CSS :invalid pseudo-class matches elements that fail data-validation constraints. It can highlight invalid values or empty required fields, including before the user has interacted with them.

Basic · CSS modules; structured CSSWG indexes reconciled with pinned MDN BCD; Chromium 152 scope gate, per-example verification still required
CSS

:is() — matching any selector

The :is() pseudo-class groups alternative selectors. It takes the highest argument specificity, including arguments that do not match.

Intermediate · CSS modules; structured CSSWG indexes reconciled with pinned MDN BCD; Chromium 152 scope gate, per-example verification still required
CSS

:lang() — selecting elements by content language

The :lang() pseudo-class selects elements by their content language, including language determined from an ancestor. It enables language-specific styling without adding a lang attribute to every element.

Basic · CSS modules; structured CSSWG indexes reconciled with pinned MDN BCD; Chromium 152 scope gate, per-example verification still required
CSS

:last-child — the last element among siblings

The :last-child pseudo-class selects an element that is last among its element siblings. It tests tree position, not visual order.

Basic · CSS modules; structured CSSWG indexes reconciled with pinned MDN BCD; Chromium 152 scope gate, per-example verification still required
CSS

:last-of-type — last element of its type

The :last-of-type pseudo-class selects the last element of its type among siblings, not necessarily the last child.

Basic · CSS modules; structured CSSWG indexes reconciled with pinned MDN BCD; Chromium 152 scope gate, per-example verification still required
CSS

:left — left-page pseudo-class

The :left pseudo-class in an @page selector selects left-hand pages of a paginated document. It allows different margins, such as a larger right margin for binding. It does not select HTML elements.

Basic · CSS modules; structured CSSWG indexes reconciled with pinned MDN BCD; Chromium 152 scope gate, per-example verification still required
CSS

:link — unvisited links

The `:link` pseudo-class selects hyperlinks the browser treats as unvisited. It does not select `a` elements without an `href` attribute.

Basic · CSS modules; structured CSSWG indexes reconciled with pinned MDN BCD; Chromium 152 scope gate, per-example verification still required
CSS

::marker — list marker pseudo-element

The ::marker pseudo-element styles a list item's bullet or number independently of its text. It supports a limited set of properties, including color and font properties.

Basic · CSS modules; structured CSSWG indexes reconciled with pinned MDN BCD; Chromium 152 scope gate, per-example verification still required
CSS

:modal — modal-state pseudo-class

The :modal pseudo-class selects elements in a modal state, not merely visible or open elements. It can style a dialog opened with showModal() while distinguishing it from a dialog opened with show().

Basic · CSS modules; structured CSSWG indexes reconciled with pinned MDN BCD; Chromium 152 scope gate, per-example verification still required
CSS

Selector nesting and the & selector

Native CSS nesting allows rules inside rules. The & selector refers to the elements matched by the parent rule.

Intermediate · CSS modules; structured CSSWG indexes reconciled with pinned MDN BCD; Chromium 152 scope gate, per-example verification still required
CSS

Next-sibling combinator (+)

The selector A + B matches an element B immediately preceded by an element A with the same parent. Whitespace, text, and comments between the elements do not break this adjacency.

Basic · CSS modules; structured CSSWG indexes reconciled with pinned MDN BCD; Chromium 152 scope gate, per-example verification still required
CSS

:not() — negation pseudo-class

The :not() pseudo-class selects elements that match none of the selectors in its argument list.

Intermediate · CSS modules; structured CSSWG indexes reconciled with pinned MDN BCD; Chromium 152 scope gate, per-example verification still required
CSS

:nth-child() — selection by position

The :nth-child() pseudo-class selects elements by their position among siblings. It supports An+B patterns and optional filtering with of S.

Intermediate · CSS modules; structured CSSWG indexes reconciled with pinned MDN BCD; Chromium 152 scope gate, per-example verification still required