Re: DRYing up media queries

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