liveBook · Manning

Media feature

As explained in CSS in Depth, Second Edition

A CSS media feature is a condition describing an aspect of the output environment, such as viewport width, resolution, orientation, or pointer precision.

A CSS media feature describes an aspect of the output environment, letting a media query respond to viewport size, orientation, resolution, or pointer precision. section 7.2.1

Common media features include:

  • Use min-width and max-width to target viewports above or below a threshold. section 7.2.1
  • Use height, orientation, and resolution features to adapt layouts or imagery. section 7.2.1
  • Use pointer: coarse or pointer: fine to adjust controls for touchscreen or precise pointing devices. section 7.2.1
@media (min-width: 320px) and (max-width: 560px) { … }

Combines two media features so a rule applies only when both viewport conditions match. section 7.2.1

How CSS in Depth, Second Edition covers it

How deep it goes
Defines common features and condition-combining syntax, but defers the complete feature list to MDN.
Examples
Uses width, height, orientation, resolution, pointer, dark-mode, light-mode, and print conditions.
What it assumes
Assumes familiarity with CSS media queries and introduces media features through viewport-based conditions.
What you can do after
Apply media features in CSS to adapt layouts, imagery, themes, and click targets to device conditions.
How it connects
Connects media queries with responsive design, viewport dimensions, screen resolution, orientation, and pointer precision.

Related concepts

This explainer was generated by Manning's knowledge graph from the text of CSS in Depth, Second Edition. The section links point to the parts of the book it draws on.