liveBook · Manning

Media query

As explained in D3.js in Action, Third Edition

A CSS media query is a conditional CSS construct that applies styles when specified device or viewport characteristics match.

A media query conditionally applies CSS styles when device or viewport characteristics match. In responsive visualizations, it adapts layouts, labels, and spacing to phones, tablets, desktops, and resized windows. section 9.1.2 section 9.2

Use media queries to change a visualization’s presentation as available space changes:

  • A desktop-first design can use max-width queries to progressively simplify layouts and focus on critical information at smaller widths. section 9.1.2
  • Responsive rules can rearrange dashboard visualizations across desktop, tablet, and mobile layouts without removing the underlying rows. section 9.3.1
  • Media queries address layout changes, while JavaScript resize listeners can handle behavior that CSS alone cannot provide. section 9.2

How D3.js in Action, Third Edition covers it

How deep it goes
Explains max-width and min-width breakpoints through responsive charts and grids, but stops short of detailed CSS query syntax.
Examples
Demonstrates line-chart adaptation and a dashboard containing rankings, scatterplot, and bar-chart visualizations.
What it assumes
Assumes basic CSS layout knowledge while demonstrating responsive behavior through charts, containers, rows, and columns.
What you can do after
Apply it via CSS to create breakpoint-based layouts that reorganize content and preserve readable responsive visualizations.
How it connects
Connects responsive design with CSS, flexbox, grid layout, SVG, JavaScript resize events, and data visualization.

Also explained in

Compare how 7 books explain media query →

Related concepts

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