Container Queries are Actually Coming / Say Hello To CSS Container Queries

In addition to my first look + demo at Container Queries, both Andy Bell and Ahmad Shadeed have also published posts covering Container Queries. Ahmad starts off with explaining the idea behind them, before digging into a ton of use-cases. I especially like the pagination use-case, something I hadn’t thought of yet myself. In his …


This content originally appeared on Bram.us and was authored by Bramus!

In addition to my first look + demo at Container Queries, both Andy Bell and Ahmad Shadeed have also published posts covering Container Queries.

~

Ahmad starts off with explaining the idea behind them, before digging into a ton of use-cases. I especially like the pagination use-case, something I hadn’t thought of yet myself.

~

In his post, Andy taps into a — not yet existentcw unit, where 1cw equals 1% of the container. This comes in handy for tweaking the font-size based on the available space.

/* Before */
h1 {
  font-size: clamp(
    var(--fluid-type-min, 1rem),
    calc(1rem + var(--fluid-type-target, 3vw)),
    var(--fluid-type-max, 1.3rem)
  );
}

/* After */
h1 {
  font-size: clamp(
    var(--fluid-type-min, 1rem),
    calc(1rem + var(--fluid-type-target, 5cw)),
    var(--fluid-type-max, 1.3rem)
  );
}

Yes, we totally need this type of unit!

~

Container Queries are Actually Coming (by Andy) →
Say Hello To CSS Container Queries (by Ahmad) →


This content originally appeared on Bram.us and was authored by Bramus!


Print Share Comment Cite Upload Translate Updates
APA

Bramus! | Sciencx (2021-04-14T21:22:44+00:00) Container Queries are Actually Coming / Say Hello To CSS Container Queries. Retrieved from https://www.scien.cx/2021/04/14/container-queries-are-actually-coming-say-hello-to-css-container-queries/

MLA
" » Container Queries are Actually Coming / Say Hello To CSS Container Queries." Bramus! | Sciencx - Wednesday April 14, 2021, https://www.scien.cx/2021/04/14/container-queries-are-actually-coming-say-hello-to-css-container-queries/
HARVARD
Bramus! | Sciencx Wednesday April 14, 2021 » Container Queries are Actually Coming / Say Hello To CSS Container Queries., viewed ,<https://www.scien.cx/2021/04/14/container-queries-are-actually-coming-say-hello-to-css-container-queries/>
VANCOUVER
Bramus! | Sciencx - » Container Queries are Actually Coming / Say Hello To CSS Container Queries. [Internet]. [Accessed ]. Available from: https://www.scien.cx/2021/04/14/container-queries-are-actually-coming-say-hello-to-css-container-queries/
CHICAGO
" » Container Queries are Actually Coming / Say Hello To CSS Container Queries." Bramus! | Sciencx - Accessed . https://www.scien.cx/2021/04/14/container-queries-are-actually-coming-say-hello-to-css-container-queries/
IEEE
" » Container Queries are Actually Coming / Say Hello To CSS Container Queries." Bramus! | Sciencx [Online]. Available: https://www.scien.cx/2021/04/14/container-queries-are-actually-coming-say-hello-to-css-container-queries/. [Accessed: ]
rf:citation
» Container Queries are Actually Coming / Say Hello To CSS Container Queries | Bramus! | Sciencx | https://www.scien.cx/2021/04/14/container-queries-are-actually-coming-say-hello-to-css-container-queries/ |

Please log in to upload a file.




There are no updates yet.
Click the Upload button above to add an update.

You must be logged in to translate posts. Please log in or register.