Container Queries Fallback Behavior #19137
kamyarkaviani
started this conversation in
Ideas
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
-
It's great that we can use
@containerand@md, syntax now. But according to https://caniuse.com/css-container-queries container queries are still not 99%+ supported on all browsers. Most browsers just introduced it around 2023, so a good portion of users who are using older computers or public ones like library, are going to be stuck with older browsers that don't support this.In my project, in order to support fallback behavior I did this:
And similar for other sizes. This way I can mark the container with
@container/contentand then usecontent-md:whatever, and if the browser doesn't support container queries, at least we use the backup viewport query. I know this isn't ideal, but the big reasons we needed this was to make the right section of an app with sidebar responsive to the size of the right section, not the size of the viewport. So the media query would be the next best try.I'm wondering if you can build some native fallback behavior for browsers that don't yet support container queries? What is your take? Does tailwind already include polyfills for container queries, or will they just not work on older browsers?
Beta Was this translation helpful? Give feedback.
All reactions