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

Re: DRYing up media queries

From: Simon Sapin <simon.sapin@exyr.org>
Date: Sat, 25 May 2013 10:31:23 +0800
Message-ID: <51A0227B.8040206@exyr.org>
To: www-style@w3.org
Le 25/05/2013 09:30, Tab Atkins Jr. a écrit :
> We could possibly say that properties defined on the root element are
> accessible across the stylesheet, but that might be weird.

In addition to being weird, we’d have to find some way to break the 
definition cycle that usually prevented by this part of css3-mediaqueries:

> To avoid circular dependencies, it is never necessary to apply the
> style sheet in order to evaluate expressions. For example, the aspect
> ratio of a printed document may be influenced by a style sheet, but
> expressions involving ‘device-aspect-ratio’ will be based on the
> default aspect ratio of the user agent.

For example, how would this work?

:root { var-my-query: (min-width: 600px) }
@media var(my-query) {
    :root { var-my-query: (max-width: 600px) }
}

-- 
Simon Sapin
Received on Saturday, 25 May 2013 02:31:51 UTC

This archive was generated by hypermail 2.3.1 : Saturday, 25 May 2013 02:31:51 UTC