Using variables in media queries

50 views
Skip to first unread message

Dima Livshits

unread,
Mar 5, 2015, 4:52:00 AM3/5/15
to closure-style...@googlegroups.com
Example gss:
@def WIDTH 1000px;
.width {
  width: 100%;
}
@media (min-width: WIDTH) {
  .width {
    width: WIDTH;
  }
}
Result will be:
.width {
  width: 100%;
}
@media (min-width:WIDTH) {
  .width {
    width: 1000px;
  }
}
Expected to see:
.width {
  width: 100%;
}
@media (min-width:1000px) {
  .width {
    width: 1000px;
  }
}
Does anybody know how to solve that?
Thanks :)

Dima Livshits

unread,
Mar 5, 2015, 12:44:41 PM3/5/15
to closure-style...@googlegroups.com
Yea... I have found a trick :)
@def WIDTH 1000px;
@def MEDIA (min-width: 1000px);
@media MEDIA {
  .width {
    width: WIDTH;
  }
}
It`s not looking good, but it works :)
I hope it will be useful to someone.
Thanks for attention.

четверг, 5 марта 2015 г., 12:52:00 UTC+3 пользователь Dima Livshits написал:
Reply all
Reply to author
Forward
0 new messages