← Shorts —

This morning, Jeremy Keith blogged about container queries. He provides much to chew on, but right now I just want to tackle this paragraph, because it seemed as good of an excuse as any to push an experiment out the door:

Custom properties feel like they could be wrangled to help with the container query problem. While it’s easy to think of custom properties as being like Sass variables, they’re much more powerful than that—the fact they can be a real-time bridge between JavaScript and CSS makes them scriptable. Alas, custom properties can’t be used in media queries but maybe some clever person can figure out a way to get the effect of container queries without a query-like syntax.

I’d been thinking along the same lines; here’s my best shot at a custom-properties-based interface for container/element queries: presto-points.

I’ve got draft post about this experiment titled Two Good Ideas and a Bad Idea About Container Queries. Spoiler alert, the bad idea is the custom properties interface. The syntax hits a nice little 80/20 point, as far as what I think most people want to do right now, and might provide a not-terrible stopgap while we wait for something better. But it isn’t a sufficiently flexible foundation for the future. For that, I think, we really do want a true query-like syntax.

More later and hopefully soon.