PHPnews.io

The Raven Technique: One Step Closer to Container Queries

Written by Bram.us / Original link on Nov. 12, 2020

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 calc(), min(), max() and clamp() are things I like and understand.

Next step: build a container-query-like solution with them.

Leveraging 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 😉

css-raven.png

The Raven Technique: One Step Closer to Container Queries →

bram bram link tutorialzine bram

« (t,i,x,y) => “creative code golfing” - HTTP/2 Push is dead »