Friday, February 7, 2025
HomeProgrammingContainer Question Items: Cqi And Cqb

Container Question Items: Cqi And Cqb


Somewhat gem from Kevin Powell’s “HTML & CSS Tip of the Week” web site, reminding us that utilizing container queries opens up container question models for sizing issues based mostly on the dimensions of the queried container.

cqi and cqb are just like vw and vh, however as a substitute of caring concerning the viewport, they care about their containers measurement.

cqi is your inline-size unit (normally width in horizontal writing modes), whereas cqbhandles block-size (normally top).

So, 1cqi is equal to 1% of the container’s inline measurement, and 1cqb is the same as 1% of the container’s block measurement. I’d be remiss to not point out the cqmin and cqmax models, which consider both the container’s inline or block measurement. So, lets say 50cqmax and that equals 50% of the container’s measurement, however it is going to have a look at each the container’s inline and block measurement, decide which is bigger, and use that to calculate the ultimate computed worth.

1200px by 500px rectangle showing that 50cqmax is equal to 50% of the larger size.

That’s a pleasant sprint of conditional logic. It may well assist keep proportions should you suppose the writing mode would possibly change on you, reminiscent of shifting from horizontal to vertical.


Direct Hyperlink →

RELATED ARTICLES

LEAVE A REPLY

Please enter your comment!
Please enter your name here

- Advertisment -
Google search engine

Most Popular

Recent Comments