Chapter 2. Media Queries – Supporting Differing Viewports

In the previous chapter, we had a brief look at the essential components for a responsive web page: a fluid layout, fluid images, and media queries.

This chapter will look in detail at media queries, hopefully providing all that's needed to fully understand their capability, syntax, and future development.

In this chapter, we shall:

  • Learn why media queries are needed for a responsive web design
  • Understand the media query syntax
  • Learn how to use media queries in link tags, with CSS @import statements and within CSS files themselves
  • Understand what device features we can test for
  • Use media queries to facilitate visual changes dependent upon available screen space
  • Consider whether media queries should ...

Get Responsive Web Design with HTML5 and CSS3 - Second Edition now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.