Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Calculations in media queries #1903

Closed
lukyer opened this issue Feb 27, 2014 · 2 comments
Closed

Calculations in media queries #1903

lukyer opened this issue Feb 27, 2014 · 2 comments

Comments

@lukyer
Copy link

lukyer commented Feb 27, 2014

LESS CODE:
@x: 0.6
@media screen and (max-width: 1735px*@x)

Does not compile into expected:
@media screen and (max-width: 1041px)

However into:
@media screen and (max-width: 1735px*0.6)

It's not a big deal, but it's inconstinent with declarations like:
width: 1735px*@x

This one works as expected:
width: 1041px

EDIT: With parenthess is calculation OK:
@x: 0.6
@media screen and (max-width: (1735px*@x))

@seven-phases-max
Copy link
Member

Please use backticks to format your code.

Yes, known limitation, see #1480 (probably needs to be documented). All arithmetic within media query expressions requires parens (regardless of the --strict-math option value). e.g.:

@var: (1 + 1); // parens have to be even here
@media (max-width: @var) {}

Related to #1880.

@seven-phases-max
Copy link
Member

Closing as duplicate of #1480.

akudev added a commit to SAP/openui5 that referenced this issue Nov 21, 2014
Workaround for LESS issue less/less.js#1903

Change-Id: I3817e5969a17c5b014f0bc4b3e41ea9422982b9c
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants