Loading tutorials
@container class: what CSS it generates, what it changes about the element that carries it, and how child variants find it. It assumes you know flexbox and grid, can read Tailwind utility classes, use variants such as md: and lg:, and know that a media query tests the v8 min readmd: and lg: work, and that you have marked an element with @container. The examples use Tailwind v4 syntax. The v3 setup is covered in a later cha5 min read@md reads the width of the nearest @container ancestor. This chapter covers the scale behind those names: which widths they stand for, how they differ from the viewport breakpoints you already know, and what the scale shares with other uti6 min read@container and styling children with @sm, @md and @lg. You should also know the default container size scale. Here you learn how to apply styles below a container size, and h7 min read@container and style children with variants such as @md:. It covers what happens when containers sit inside other containers, and how to choose which one a variant reads.6 min read@sm, @md, @lg and so on) covers most layouts. Sometimes a design needs a switch point that isn't on the scale, such as "go horizontal at 475px". This chapter covers arbitrary container variants, which let you write that value directly in a class name.6 min read@container, style children with variants such as @md:, and write arbitrary values like w-[50cqw]. You should know what a viewport unit such as vw means. The chapter covers the CSS container query length units, how Tailwind exposes the6 min read@container and style its children with variants such as @md: and @lg:. It also assumes you know the default container size scale and have seen Tailwind v4's @theme directive. Here you will change that scale: add new sizes, override ex6 min read@container and @md: do and how viewport variants such as md: differ from container variants. You should also be comfortable edit7 min readmd:, lg:), and you have used @container with variants such as @md: as shown earlier in this tutorial. Container queries fail silently. A variant that doesn't match produces no error, so you debug by 7 min read