Change styles based on device and viewport.
Every Sfumato utility class can be applied conditionally at different media breakpoints, which makes it easy to build responsive interfaces right in your HTML.
To ensure things work across breakpoints (e.g. on mobile), make sure you've configured the viewport meta tag in the <head> block of your document:
To add a style that only takes effect at a specific breakpoint, just prefix the utility name with the breakpoint name, followed by a colon:
These work for every utility class in the Sfumato framework, which means you can change any styles at a given breakpoint.
Styles applied by rules like md:grid-cols-3 will apply at that breakpoint and stay applied at wider breakpoints.
If you need to apply a utility for a specific breakpoint range, stack a responsive variant like md with a max-* variant to limit that style to a specific range:
Container queries can also be specified with ranges:
There are five default breakpoints with width values representing common device resolutions:
There are seven default adaptive breakpoints with aspect-ratio values representing common device aspect ratios, for more specific targeting:
Container queries are a newer addition to CSS that allow you to apply styles depending on the dimensions of a parent element rather than the whole browser window. This means you can create components that adapt their appearance to the specific space they occupy, making them more flexible and easier to reuse in different layouts.
You can also name your containers for more specific targeting, like when nested.
Following are all available standard @media query variants, including max varieties:
Following are all available adaptive design @media query variants, including max varieties:
Following are all available @container query variants, including max varieties: