Width is only one of the many abilities of media queries. Modern CSS can also sense screen orientation, the user's dark-mode preference, whether they want reduced motion, the type of input device, and even whether the page is being printed — these "environment-sensing" abilities are key to building interfaces that truly care about the user.
This tutorial site's own dark mode is implemented with it — detecting the theme preference at the operating system / browser level, and combined with CSS custom properties, it achieves "theme switching with zero JavaScript".
Practice tipAlways define colors on custom properties (tokens) and have component styles reference only the tokens, rather than scattering media queries into every color declaration — this keeps the maintenance cost of dark mode to a minimum.
prefers-reduced-motion: Reducing Motion
Some users (people sensitive to vestibular disorders) enable "reduce motion" in their system settings; respecting this preference is a basic requirement of accessible design.
Touch screens have no true "hover"; the hover and pointer features distinguish precise pointing devices (mouse) from coarse ones (finger).
/* enable the hover effect only on devices that support hover with precise pointing */@media (hover: hover) and (pointer: fine) {
.btn:hover { transform: translateY(-2px); }
}
The print Media Type
A media type rather than a feature, used to distinguish output media. A common practice is hiding navigation and interactive controls when printing, keeping only the main content.