A rule in a website's styling code that applies different formatting depending on the device, such as screen width, orientation, or whether the user prefers dark mode.
Synonyms
None recorded.
Related terms
In plain words
- the code that says 'if the screen is small, do this instead'
Usage example
A media query hid the sidebar whenever the screen was narrower than a tablet.
Don't confuse with…
- container queryA media query responds to the whole screen or window; a container query responds to the size of a single component's own container.
Categories
- Responsive & adaptive design