Skip to content

[css-cascade] What is a valid at-rule? Or what is an invalid at-rule? #9175

Open
@romainmenke

Description

@romainmenke

https://drafts.csswg.org/css-cascade-5/#at-import

Any @import rules must precede all other valid at-rules and style rules in a style sheet (ignoring @charset and @layer statement rules) and must not have any other valid at-rules or style rules between it and previous @import rules, or else the @import rule is invalid.

After reading this I was curious what the exact definition is for a valid at-rule.

I assume that the intention is to allow new at-rules to be added to the language later without invalidating all imports in older browser versions.

It wasn't immediately clear to me exactly when an at-rule becomes invalid.

Is it only when the at-keyword-token is unknown? (e.g. @unknown {})


Things I noticed I could place before an @import and still have it apply :

@unknown {}

@import url("./green.css");
@ {}

@import url("./green.css");
{}

@import url("./green.css");

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