Web Compendium Sitemap

CSS Selectors

Selector Types

Combinators

Pseudo-Classes

Specificity

Cascade Layers

To support older browsers, there is a Cascade Layers polyfill [csstools/postcss-plugins, oddbird.net].

Forgiving Selectors

CSS Nesting

The nesting syntax was decided on using a poll [webkit.org, chrome-dev, bram.us].

Lobotomized Owl

The 'lobotomized owl' selector * + * consists of two universal selectors and an adjacent sibling combinator. It selects elements that are preceded by an adjacent sibling element. In other words, everything except the first element is being selected. This selector is often used to apply margins in between two elements. It thus allows to define vertical rhythm without having any undesired bottom spacing on the last element. [alistapart.com]

Several adaptations of the selector and/or the styling it applies exist. One example is to use a generic class name and then apply a variable margin—or a default margin if no specific custom property was defined in the scope. [andy-bell.co.uk]

.flow > * + * {
  margin-block-start: var(--flow-space, 1em);
}

The alternative selector .flow > :not(:first-child) targets the exact same elements. But it has a higher specificity than the Lobotomized Owl selector. It is therefore not recommended to use the alternative selector for this use case.