Media Types and @-rules
Don’t get too excited yet. We aren’t talking about media types in the sense of things like audio and video authoring. Well, not exactly, anyway. We’re talking about creating rules for presentation within various kinds of media. The defined types of media thus far are:
screen
, as in a computer screenprint
, for things like printouts and print-preview displaysprojection
, for projected presentations such as slide showsbraille
andembossed
, for tactile feedback devices and printersaural
, for speech generatorstv
, for television-type displays (think WebTV)tty
, for fixed-width character displayshandheld
, for palmtop computersthe ubiquitous
all
These are all values of @media
, one of several new
@-rules. Some others are:
@font-face
, which is used in the definition of a font by manual means@import
, which has more power than under CSS1 by allowing authors to associate media types with@import
statements; for example,@import
(print.css)
print;
@page
, which allows you to define the styles of a page when using paged-media style sheets; for example,@page
{size:
8.5in
11in;}
Paged Media
Since I just brought up paged media, I should probably mention that there are some new properties that apply to such media. Five of them apply to page breaks and where they appear:
page-break-before page-break-after page-break-inside orphans widows
The first two are used to control whether a page break should appear before or after a given element, and the latter two are common ...
Get Cascading Style Sheets: The Definitive Guide 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.