Skip to content

[css-values] calc() grammar doesn't seem to allow for min()/max() inside calc() #1781

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

Closed
litherum opened this issue Sep 6, 2017 · 2 comments

Comments

@litherum
Copy link
Contributor

litherum commented Sep 6, 2017

https://drafts.csswg.org/css-values/#calc-syntax

<calc()> = calc( <calc-sum> )
<min()>  = min( <calc-sum># )
<max()>  = max( <calc-sum># )
<calc-sum> = <calc-product> [ [ '+' | '-' ] <calc-product> ]*
<calc-product> = <calc-value> [ '*' <calc-value> | '/' <calc-number-value> ]*
<calc-value> = <number> | <dimension> | <percentage> | ( <calc-sum> )
<calc-number-sum> = <calc-number-product> [ [ '+' | '-' ] <calc-number-product> ]*
<calc-number-product> = <calc-number-value> [ '*' <calc-number-value> | '/' <calc-number-value> ]*
<calc-number-value> = <number> | ( <calc-number-sum> )

Seems like you can't put a min() inside a calc()? Or am I reading this wrong?

@litherum litherum added the css-values-4 Current Work label Sep 6, 2017
@tabatkins
Copy link
Member

Ah whoops, indeed. (As written you can't nest min/max in each other either.) I just need to add some more grammar terms.

@tabatkins
Copy link
Member

Oh wait, never mind, it's fine - a calc(), min(), or max() are always a <number> | <dimension> | <percentage>, so you can sub them into the <calc-value> term.

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