Replies: 2 comments
-
|
Seems to be different in Tailwind Play but otherwise works as I expect: .container {
width: 100%;
@media (width >= 20rem) {
max-width: 20rem;
}
@media (width >= 40rem) {
max-width: 40rem;
}
@media (width >= 50rem) {
max-width: 50rem;
}
@media (width >= 96rem) {
max-width: 96rem;
}
}
Regardless, you may not wish to affect @utility container {
/* Reset `max-width`s */
max-width: none;
@media (width >= 20rem) {
max-width: 20rem;
}
@media (width >= 50rem) {
max-width: 50rem;
}
} |
Beta Was this translation helpful? Give feedback.
-
|
In Tailwind CSS v4, if you want full control over the This allows you to reset the @theme {
--breakpoint-md: 20rem;
--breakpoint-lg: 50rem;
/* Ensure 2xl is set to initial if you want to remove it */
--breakpoint-2xl: initial;
}
@utility container {
margin-inline: auto; /* Center the container */
width: 100%;
max-width: none; /* Reset existing max-widths */
@media (width >= --theme(--breakpoint-md)) {
max-width: var(--theme(--breakpoint-md));
}
@media (width >= --theme(--breakpoint-lg)) {
max-width: var(--theme(--breakpoint-lg));
}
}Why this works:
Using this method, you avoid the " |
Beta Was this translation helpful? Give feedback.
Uh oh!
There was an error while loading. Please reload this page.
-
Seems there's nothing in the docs for this in v4, only results for "container" are trying to sell Tailwind UI and stuff about unrelated container queries.
So I've customized all my breakpoints, but .container for some reason does not listen to those.
Is this correct, or broken?
I tried this just to test it out:
which results in this still:
I need these to be for example 20rem and 50rem. (made up numbers I'll figure out exacts once I get it actually functioning).
Beta Was this translation helpful? Give feedback.
All reactions