Read CSS: The Definitive Guide, 3rd Edition Online
Authors: Eric A. Meyer
Tags: #COMPUTERS / Web / Page Design
Although the first stage of the Web's development was primarily visual in nature, the
need to provide web content in other media led to the introduction of medium-specific
styling in CSS. The ability to take the same document and customize its presentation in
a manner best suited to different output media is deeply powerful. Although its most
common application is to create "printer-friendly" styles for documents, we've also seen
how projection styles can be used to create slideshows with Opera.
While aural styles would be very useful for blind users, there are only two programs
as of this writing that support even a fragment of this portion of CSS, and the media
typeaural
defined in CSS2.x will not be carried
forward to future versions of CSS. Instead, the media typespeech
has been set aside for future work in auditory rendering of
documents.
This is a shorthand method to express all of the individual background properties
within a single declaration. Use of this property is generally encouraged over the
individual properties, as it has a slightly better support profile in older browsers
and doesn't take as long to type.
[ inherit
Refer to individual properties
All elements
No
Values are allowed for
See individual properties
This property defines whether the background image scrolls along with the element
when the document is scrolled. This can be used to create "aligned" backgrounds; see
Chapter 9
for more details.
scroll
|fixed
|inherit
scroll
All elements
No
As specified
This
sets a solid color for the background of the element. This color fills the content,
padding, and border areas of the element, extending to the outer edge of the
element's border. Borders that have transparent sections, such as dashed borders,
will show the background color through the transparent sections.
transparent
|inherit
transparent
All elements
No
As specified
This places an image in the background of the element. Depending on the value ofbackground-repeat
, the image may tile
infinitely, along one axis, or not at all. The initial background image (the origin
image) is placed according to the value ofbackground-position
.
none
|inherit
none
All elements
No
Absolute URI
This property sets the position of the background's origin image (as defined bybackground-image
); this is the point from which
any background repetition will occur.
[[left
|center
|right
] [top
|center
|bottom
]?] |
[[left
|center
|right]
||
[top
|center
|bottom
]] |inherit
0% 0%
Block-level and replaced elements
No
Refer to the corresponding point on both the element and the origin
image
The absolute length offsets, if
percentage values
This defines the
tiling pattern for the background image. Note that the axis-related repeat values
actually cause repetition in
both
directions along the relevant
axis. The repetition begins from the origin image, which is defined as the value ofbackground-image
and is placed according to the
value ofbackground-position
.
repeat
|repeat-x
|repeat-y
|no-repeat
|inherit
repeat
All elements
No
As specified
This is a shorthand property that defines the width, color, and style of an
element's border. Note that while none of the values are actually required, omitting
a border style will result in no border being applied because the default border
style isnone
.
[
|inherit
Refer to individual properties
All elements
No
As specified
This shorthand property defines the width, color, and style of the bottom border
of an element. As withborder
, omission of a
border style will result in no border appearing.
[
|inherit
Not defined for shorthand properties
All elements
No
See individual properties (border-width
, etc.)
This property sets the color for the visible portions of the bottom border of an
element. Only a solid color can be defined, and the border's style must be a value
other thannone
orhidden
for any border to appear.
transparent
|inherit
The value ofcolor
for the
element
All elements
No
If no value is specified, use the computed value of the propertycolor
for the same element; otherwise, as
specified
This defines the
style for the bottom border of an element. The value must be something other thannone
for any border to appear. In CSS1, HTML
user agents were only required to supportsolid
andnone
.
none
|hidden
|dotted
|dashed
|solid
|double
|groove
|ridge
|inset
|outset
|inherit
none
All elements
No
As specified
This sets the width for the bottom border of an element, which will take effect
only if the border's style is something other thannone
. If the border style isnone
, the
border width is effectively reset to0
. Negative
length values are not permitted.
thin
|medium
|thick
|inherit
medium
All elements
No
Absolute length;0
if the style
of
the border isnone
orhidden
This shorthand property sets the color for the visible portions of the overall
border of an element or sets a different color for each of the four sides. Remember
that a border's style must be something other thannone
orhidden
for any border to
appear.
[ transparent
]{1,4} |inherit
Not defined for shorthand properties
All elements
No
See individual properties (border-top-color
, etc.)
This shorthand property
defines the width, color, and style of
the left border of an element. As withborder
, omission of a border style will result in no
border appearing.
[
|inherit
Not defined for shorthand properties
All elements
No
See individual properties (border-width
, etc.)
This property sets the color for the visible portions of the left border of an
element. Only a solid color can be defined, and the border's style must be something
other thannone
orhidden
for any border to appear.
transparent
|inherit
The value ofcolor
for the
element
All elements
No
If no value is specified, use the computed value of the propertycolor
for the same element; otherwise, as
specified