Re: [css-variables][mediaqueries] Allow var() in media queries?

Glen Huang:
> When you design the media query break points according to certain
> element dimensions, being able to use variables in media queries can
> be very helpful.

I agree it would be helpful, but a problem with this is that you can
easily set up rules inside the @media that change what the @media
condition evaluates to:

  :root {
    --page-width: 768px;
  }

  @media (min-width: var(--page-width)) {
    :root {
      --page-width: 120px;
    }
  }

So far CSS has avoided adding any new situations like this (the existing
problem with :hover rules moving the element is one we are stuck with).

-- 
Cameron McCormack ≝ http://mcc.id.au/

Received on Saturday, 4 April 2015 23:42:28 UTC