
CSS Media Queries: How to Make Your Site Responsive
A CSS media query applies styles only when the browser meets a condition, usually viewport width.
A site that looks great on a laptop and breaks on a phone is a broken site. Responsive design is the practice of building one layout that adapts to every viewport, from a 320px phone to an ultrawide monitor. This section covers the tools that make it work: media queries, a mobile-first mindset, fluid units, and responsive images that ship the right file to the right device.

A CSS media query applies styles only when the browser meets a condition, usually viewport width.

Mobile-first CSS means writing your base styles for the smallest screen first, then using min-width media queries to progressively add complexity as the.

Responsive web design is the practice of building one website that adapts to any screen size, from small phones to large desktops, instead of maintaining.

Responsive images in CSS require two jobs working together: the HTML srcset and sizes attributes tell the browser to download an appropriately sized file.