W3C home > Mailing lists > Public > www-style@w3.org > May 2016

[mediaqueries][css-conditional] else

From: Florian Rivoal <florian@rivoal.net>
Date: Fri, 13 May 2016 18:41:26 +0900
Message-Id: <D46EEA49-7A88-42D6-BF01-8F624E857269@rivoal.net>
To: CSS WG <www-style@w3.org>
During the face to face, we talked about the fact setting default styles outside of a media query, then undoing then in the media query before applying new ones is painful, and that authors often want to do something like if/else.

I suggest we go with this syntax:

@media (something) {
 ...
 ...
 ...
 @else {
 }
}

@supports (foo:bar) {
 ...
 ...
 ...
 @else {
 }
}

I think putting the else inside the conditional rather than following it, is more consistent with how things work in CSS, since we don't currently have a concept of associating two separate @rules.

The transition phase isn't too nice, as this isn't really usable until all browsers support it, but I think this is going to be the case for any syntax we can pick for this feature.

Thoughts?

- Florian
Received on Friday, 13 May 2016 09:45:10 UTC

This archive was generated by hypermail 2.4.0 : Monday, 23 January 2023 02:14:59 UTC