W3C home > Mailing lists > Public > www-style@w3.org > May 2016

[css3-values] percentage in calc() and attr()

From: Yves Lafon <ylafon@w3.org>
Date: Wed, 4 May 2016 10:46:15 +0200
Message-Id: <8DAB5A8C-1357-4F8C-ACB8-B7251845D472@w3.org>
To: www-style list <www-style@w3.org>
In https://drafts.csswg.org/css-values/#attr-notation
the <type-or-unit> definition has this for percentage:
‘%’, A keyword matching one of the <length>, <angle>, <time>, or <frequency> units
In https://drafts.csswg.org/css-values/#calc-type-checking
If percentages are accepted in the context in which the expression is placed, a <percentage-token> has the type of the value that percentages are relative to; otherwise, a math expression containing percentages is invalid.
does it imply that it can be used only in those cases ? (like width: attr(foo %)  of width: calc(10% / 3) )

ie: is color: rgb(attr(foo %), calc(attr(bar %) + 10% ), 45); allowed ?

There is an example in the spec using hsl, but no assertion on its validity.
Some clarification in the spec would be useful.

(Note that if in the color case % resolves to number, then the attr() definition is wrong unless attr() is forbidden here.

Baroula que barouleras, au tiéu toujou t'entourneras.

Received on Wednesday, 4 May 2016 08:46:21 UTC

This archive was generated by hypermail 2.4.0 : Monday, 23 January 2023 02:14:59 UTC