Different Media Types
The World Wide Web is a wonderful thing: computers all over the world – connected together – sharing documents and multimedia. In recent years, the World Wide Web has begun to grow beyond this comfy computer-based family of devices. The Web is now accessible on mobile phones, handheld digital assistants, and televisions.
This phenomenon has placed a considerable burden on content authors. No longer can they write their documents with expectations on how that content will be displayed. Each of these new devices represents a quite different medium from the computer: the physical characteristics of the devices are different, the relationship between the device and the user is different, and the cost of using the device is different.
Until recently, authors had little choice but to author or re-author their content with each device in mind. With the advent of Cascading Style Sheets (CSS) and something called 'media types', this began to change.
In this chapter, we will learn how to use CSS and media types to tailor our documents to different devices.
In this chapter we will cover the following:
What media types are and why we need them
What the role of Cascading Style Sheets is in supporting media types
How to associate style sheets with different media types
How to use @media rules and @import rules
The differences between media types and strategies for handling them
The future of style sheets in XML
First, we will define media types and try to understand why they are important.