1

If I have few @media conditions like

@media (min-width: 640px) { ... }
@media (min-width: 640px) { ... }
@media (min-width: 2048px) { ... }
@media (min-width: 2048px) { ... }

is it possible in LESS to use something like

iphone = (min-width: 640px)
ipad = (min-width: 2048px)

@media (iphone) { ... }
@media (iphone) { ... }
@media (ipad) { ... }
@media (ipad) { ... }

?

vbezhenar
  • 11,148
  • 9
  • 49
  • 63
  • See [Fancy Media Queries](http://stackoverflow.com/questions/15837808) and similar. – seven-phases-max Mar 19 '14 at 10:52
  • possible duplicate of [Fancy Media Queries with some LESS Magic](http://stackoverflow.com/questions/15837808/fancy-media-queries-with-some-less-magic) – vbezhenar Mar 19 '14 at 11:08
  • Yes, this is a duplicate but since those times Less introduced a few new techniques and [features](http://lesscss.org/features/#detached-rulesets-feature) that may bring some alternative higher level solutions (so I supectoexpect some interesting answers here). Though the `~""` method still remains the simplest and most straight-forward way for this particular basic use-case despite the fact that these escaping "hacks" looks ugly for a Less purist :) – seven-phases-max Mar 19 '14 at 11:30

0 Answers0