- From: Christoph Päper via GitHub <sysbot+gh@w3.org>
- Date: Sun, 26 Jan 2020 23:43:21 +0000
- To: public-css-archive@w3.org
Iʼm no expert in CSS variables by any means, but as far as I understand them, they can hold a number of values (separated by whitespace or commas) that could be passed into a function all at once, but Iʼm not sure whether anyone is doing that or why they would.
``` css
foo {
--lengths: 1.2em, 34pt, 56px, 78%, 9.0mm; /* 9mm < 34pt < 56px */
font-size: min(var(--lengths)); /* min(1.2em, 78%, 9mm) */
line-height: max(var(--lengths)); /* max(1.2em, 78%, 56px) */
padding-top: mean(var(--lengths));
}
bar {
--trouble: 1em 1em 2em 2em;
margin: var(--trouble);
border: solid red mean(var(--trouble)); /* 1.5em */
padding: calc(each(var(--trouble)) * 0.2); /* 0.2em 0.2em 0.4em 0.4em */
text-decoration-width: calc(index(var(--trouble), 3) / 4); /* 0.5em */
}
```
`each` and `index` are examples of other functions that would be useful when working with sets of values of equal type.
--
GitHub Notification of comment by Crissov
Please view or discuss this issue at https://github.com/w3c/csswg-drafts/issues/4700#issuecomment-578555467 using your GitHub account
Received on Sunday, 26 January 2020 23:43:23 UTC