CSS Custom Functions are coming
1–10 of 90 posts
Re: CSS Custom Functions are coming
#2That's nuts.
The web is developing in the wrong way.
Re: CSS Custom Functions are coming
#3functions in stylesheets? That's nuts. The web is developing in the wrong way.
Re: CSS Custom Functions are coming
#4@function --light-dark(--light, --dark) {
result: var(--light);
@media (prefers-color-scheme: dark) {
result: var(--dark);
}
}Re: CSS Custom Functions are coming
#5Re: CSS Custom Functions are coming
#6Re: CSS Custom Functions are coming
#7So taking the article seriously and not just being glib:
This feels like a misunderstanding of how to write good CSS. Good CSS is a lot like SQL, which shouldn't be a surprise since it's centered around selectors. CSS is a set-based language. Adding general purpose functions that seem to abuse rule precedence to make conditional statements feels like a dirty hack to force CSS into an imperative model.
Now, maybe there is something to be said for the idea that, here we are, 30 years into having CSS, and people are still bad at set-description operations. Maybe there should be an imperative styling language. But it's a mistake to overload CSS to do it.