Skip to content

document-scoped-selector

Reports a selector variant that styles the whole document instead of the element.

This rule reports a variant that replaces the element with a document-wide target, such as [:root]:. Stillwind compiles CSS statically, so including this declaration in your code affects the document even when the element is not rendered.

Reported

style("[:root]:text-red-500");document-scoped-selector: `:root` does not depend on the styled element; declare document-wide CSS in a global stylesheet

Fixed

:root {
  @apply text-red-500;
}

How to fix

  • To style the root of the page, write a rule in your stylesheet, as in the example.
  • To style the element itself, remove the variant: style("text-red-500").

Rule settings

PresetSeverity
recommendeddeny
strictdeny
stylisticoff

Configure lint to change the severity or options.