Building further upon The Holy Albatross technique, comes The Raven Technique by Mathias Hülsbusch:
I want to get closer to actual container queries! So, what does CSS have offer that I could tap into? I have a mathematical background, so functions like
clamp()are things I like and understand.
Next step: build a container-query-like solution with them.
clamp() he builds new CSS Custom Properties (aka CSS Variables) which in their turn are used as Conditions for CSS calculations.
☝️ Did you know Chromium will be experimenting with native Container Queries, and we might eventually have them built into the browser?
You can play with the results in the pen below, by adjusting the width of
.try_out_dimensions although I’d recommend to read the explanatory post first 😉