PHP-CSS-Parser icon indicating copy to clipboard operation
PHP-CSS-Parser copied to clipboard

Support expressions within functions like `max`

Open JakeQZ opened this issue 2 months ago • 0 comments

#389 and #1437 are closed because they are too global.

Expressions as length values are not part of any standard, e.g.

.left {
  width: (10% + 0.5vw);
}

... is not valid and must by wrapped in a calc() function.

But when used within certain CSS functions, like max, are valid, e.g.

.left {
  width: min(1vw, 10% + 0.5vw);
}

Note that braces are not even required in the second argument.

Some checking-up on the standards and which CSS functions allow expressions is a pre-requisite to move this forward* - e.g. it doesn't make sense for functions like gradient(), but maybe is allowed in the arguments.

*unless anyone knows this off-by-heart

I think it's possible to incorporate the Expression class (in the abovementioned PRs), but rather as a descendant of Size...

JakeQZ avatar Dec 19 '25 02:12 JakeQZ