CSS Media Queries
All the things we can do with them.
Media selectors or media queries in CSS are used to apply different styles for different devices or device characteristics.
Webflow makes heavy use of them in its responsive breakpoint architecture, but it only uses the viewport width. Other device characteristics are not supported as "contexts" that you can design for.
One of our objectives with SA is to expand on these capabilities and support certain capabilities in orientation, aspect ratio, and so on.
But there are many!
Width and Height of the viewport: This is probably the most common use of media queries. You can use
min-width
,max-width
,min-height
, andmax-height
to apply different styles based on the size of the browser window.Width and Height of the device: Similar to the viewport, but for the physical dimensions of the device screen, you can use
min-device-width
,max-device-width
,min-device-height
, andmax-device-height
.Orientation: You can check if the device is in landscape or portrait mode.
Resolution: You can apply different styles for devices with different screen resolutions using
min-resolution
ormax-resolution
.Aspect Ratio: You can use
aspect-ratio
,min-aspect-ratio
, andmax-aspect-ratio
to apply styles based on the width-to-height ratio of the viewport, anddevice-aspect-ratio
,min-device-aspect-ratio
, andmax-device-aspect-ratio
for the device screen.Color: You can query the number of bits per color component of the output device or the color index using
color
,min-color
, andmax-color
.Monochrome: You can query the number of bits per pixel in a monochrome frame buffer using
monochrome
,min-monochrome
, andmax-monochrome
.Scan Process: You can differentiate between interlaced and progressive scan televisions using the
scan
media feature.Grid: You can query whether the output device is grid or bitmap.
Light Level: You can apply different styles depending on the ambient light level of the device environment (like
dim
,normal
,washed
).Pointer: You can apply different styles based on the presence and accuracy of a pointing device like a mouse (
none
,coarse
,fine
).
Last updated