Skip to content

[mediaqueries-5] [css-env] Replace @custom-media with custom environment variables? #6698

@valtlai

Description

@valtlai

An issue in the css-env spec says:

ISSUE 3. Define the full set of places env() can be used.

  • Should be able to replace any subset of MQ syntax, for example.

This made me think if we could define custom environment variables and use them in @media queries, would there still be a need for @custom-media or would it become redundant.

That could look something like the following:

@env --narrow-window: (max-width: 30em);

@media env(--narrow-window) {
  /* ... */
}

(The syntax could be different, of course, as the syntax for custom environment variables hasn’t yet been decided.)

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