by wbobeirne · 3y ago · 0 comments
For instance, in their `state(wrap: true)` example, now that the wrapping element is hidden, isn't it no longer wrapping? Why does the query continue to apply?
You can wave your hands around as much as you like but fundamentally this state based rule stuff says:
- apply styles
- now, query the current state
- based on the current state, apply different styles
I understand there are complex interactions that people want to cater for like sticky headers, but… really?
There’s only so far you can bandaid a declarative language like css.
If you want dynamic behaviour, use javascript. That’s why it exists.
I think container queries are cool and intuitively useful, much more so than queries based on what the browser window size happens to be.
These are not nearly as obvious to me. I get the nav bar scenario, but I think I find the quest for "CSS purity" where any design, no matter how dynamic, can be expressed without Javascript seems a bit silly. I have no problem with it, I just also don't think it's quite as noble as some seem to think.
I think you're missing the point. Adding functionality to CSS makes is mostly about separation of concerns and making desired features accessible to a wider audience than just JavaScript programmers.
And while a good programmer can do a lot with JavaScript, all of the machinery for layout—flex box, grid, container queries—is in CSS, so it makes sense to build on that.