HTML and CSS Reference
In-Depth Information
Given that the
link
element is an empty element when using XML-style syntax,
a self-identifying close using a trailing slash (/) must be included in the tag:
<!-- XHTML style -->
<link rel="stylesheet" type="text/css" href="/styles/newstyle.css" />
The
rel
attribute is generally set to the value
stylesheet
but may also have a value of
alternate stylesheet
with an associated
title
value to provide different looks for the
same page:
<link rel="stylesheet" type="text/css" href="standard.css" title="standard">
<link rel="alternate stylesheet" type="text/css" href="red.css" title="Red
Sheet">
<link rel="alternate stylesheet" type="text/css" href="green.css"
title="Green Sheet">
The
media
attribute may also be used to define the media to which a style sheet is
applied. The keyword values
screen
and
print
are commonly. The default value of
all
is
applied when media is not specified.
<link rel="stylesheet" type="text/css" href="screenstyle.css" media="screen">
<link rel="stylesheet" type="text/css" href="printstyle.css" media="print">
CSS2 and 2.1 do define a rich set of media values, as shown in Table 5-2, but in practice
few are supported.
Media Type
Definition
all
For use with all devices
For use with speech synthesizers. Support for this is spotty and most features
have been moved to later version of CSS.
aural
For use with tactile Braille devices
braille
embossed
For use with Braille printers
handheld
For use with handheld devices
For use with printed material and documents viewed onscreen in print preview mode
print
projection
For use with projected media (direct computer-to-projector presentations), or printing
transparencies for projection
screen
For use with color computer screens
speech
For use with speech synthesizers; replaces the CSS2 value
aural
tty
For use with low-resolution teletypes, terminals, or other devices with limited
display capabilities
tv
For use with television-type devices
T
ABLE
5-2
Media Types Defined by CSS 2.1