- From: Miriam Suzanne via GitHub <sysbot+gh@w3.org>
- Date: Mon, 24 Mar 2025 20:26:52 +0000
- To: public-css-archive@w3.org
That seems like a daydream. :) Functions exist in the value space of a single declaration, and return a result value - not entire declarations. You probably do want a mixin for your goal, which is why your code looks more like the proposal for mixins. Functions will only work for one property at a time, but you could do something like:
```css
@function --mq(--small, --medium: initial, --large: initial) {
result: if(
media(width > 900px) and style(--large): var(--large);
media(width > 600px) and style(--medium): var(--medium);
else: var(--small);
)
}
.example {
flex-direction: --media-values(column, row);
}
```
If you have Chrome Canary with the Experimental Web Platform Features flag turned on, [I made a demo using background-colors](https://codepen.io/editor/miriamsuzanne/pen/MYWXMGd).
--
GitHub Notification of comment by mirisuzanne
Please view or discuss this issue at https://github.com/w3c/csswg-drafts/issues/9350#issuecomment-2749315148 using your GitHub account
--
Sent via github-notify-ml as configured in https://github.com/w3c/github-notify-ml-config
Received on Monday, 24 March 2025 20:26:52 UTC