← Back to release summary

CSS Highlight Inheritance

Category
CSS
Type
No developer-visible change
Status
Enabled by default (Chrome 134)
Intent stage
None

Summary

With CSS Highlight Inheritance, the CSS Highlight pseudo classes, such as ::selection and ::highlight, inherit their properties through the pseudo highlight chain, rather than the element chain. The result is a more intuitive model for inheritance of properties in highlights. Specifically, "When any supported property is not given a value by the cascade ... its specified value is determined by inheritance from the corresponding highlight pseudo-element of its originating element’s parent element." There are some caveats due to properties not allowed on a highlight pseudo and historical usage: units depending on fonts, container queries, viewports etc. use metrics from the originating element, and all custom property values used in the highlight pseudo are taken from the originating element (inherited through the originating element cascade). (https://drafts.csswg.org/css-pseudo-4/#highlight-cascade)

Standards & signals

View on chromestatus.com