Skip to content

Container query classes cannot take CSS variable as arbitrary breakpoint value #17597

Discussion options

You must be logged in to vote

Hey!

Unfortunately this is a limitation in CSS itself, both @media and @container don't work with CSS variables. In this scenario, you can create custom variables in the @theme section: https://tailwindcss.com/docs/responsive-design#using-custom-container-sizes

Tailwind CSS will then inline the actual value in the container query.

Example Play: https://play.tailwindcss.com/Y036j2HeVZ

Replies: 1 comment 1 reply

Comment options

You must be logged in to vote
1 reply
@wintercounter
Comment options

Answer selected by wintercounter
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Help
Labels
None yet
2 participants
Converted from issue

This discussion was converted from issue #17596 on April 07, 2025 15:31.