Skip to content

[css-cascade-5] Reconsider placement of unlayered styles, for better progressive enhancement? #6284

Closed
@mirisuzanne

Description

@mirisuzanne

In the spec for Cascade Layers we define default unlayered styles as being at the top of the normal layer stack, and the bottom of the !important layers. Any explicit layers are added below the normal unlayered styles, with layered important styles above unlayered important styles.

  • first layer !important -- highest cascade priority
  • second layer !important
  • default !important
  • default (normal)
  • second layer (normal)
  • first layer (normal) -- lowest cascade priority

I'm not sure this matches either developer instinct, or the best path for authors to start integrating cascade layers as a progressive enhancement.

  • I expect authors first instinct will be to reach for layers when they want to add cascade priority to a style
  • Until layers are broadly supported, authors will want to integrate them selectively as a progressive enhancement

When I think about serving a simpler set of styles to older browsers, I would want those browsers to get the most broad defaults, along with anything most important in those defaults. But with unlayered styles at the top of the normal stack, authors are instead encouraged to move their most broadly-applied , lowest-priority styles (resets, global typography, etc) into layers first -- hiding them from old browsers. If default styles were at the bottom of the normal layers, authors could instead begin adding layers for more narrowly targeted styles.

So I'm proposing we change the way unlayered styles stack:

  • default !important -- highest cascade priority
  • first layer !important
  • second layer !important
  • second layer (normal)
  • first layer (normal)
  • default (normal) -- lowest cascade priority

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions