February 2006
Intermediate to advanced
826 pages
63h 42m
English
Content preview from Web Design in a Nutshell, 3rd EditionBecome an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
Start your free trial



@media rule
The @media rule enables style instructions for a number of media to be placed within one style sheet. Each @media rule can be interpreted as, “If the medium is going to be this, use these style instructions.” Using the same style sheet information from the original example, the style sheet would look like this:
<style>@media screen{ #printonly {display: none;} body {background: #CCC; color: #333; font: 95%;} h1 {font: 1.5em Futura, Verdana, sans-serif; color: #C03;} p {font: 1em/1.5em Verdana } }@media print{ #masthead {display: none; } #printonly {padding-bottom: 10px; border-bottom: 1px solid; font-size: 10pt; } body {background: white; color: black; width: auto; } h1 {font: 18pt Times bold;} p {font: 12pt/18pt Times; } } </style>