The Book of CSS3 - A Developer\'s Guide to the Future of Web Design (2nd edition)

(C. Jardin) #1

2


Media Queries


Back when the World Wide Web was some-
thing you only accessed via a browser on
your desktop or laptop, writing CSS was fairly
straightforward. Although you had to consider

cross-browser and cross-platform issues, at least you


knew with reasonable certainty that everyone was


using fundamentally similar devices to view your website. Over the last
few years, however, we’ve seen an explosion of new devices for accessing
the Web—from game consoles to mobile devices such as smartphones and
tablets. Presenting your content to everybody in the same way no longer
makes sense when they could be viewing your website on a wide screen
desktop monitor or a narrow handheld screen.
CSS has had a way to serve different styles to different media types for
quite some time, using the media attribute of the link element:



PX

3024
Free download pdf