Book HomeCascading Style Sheets: The Definitive GuideSearch this book Thursday 17th of April 2014 11:54:37 PM

10.9. Summary

CSS2 obviously covers a lot of ground, and exploring it in detail would probably have added at least four more chapters to this book, not to mention dramatically bulking up some of the chapters that already exist. However, since so little of CSS2 has actually been implemented at this writing, we felt it was better to provide an overview that was light on details. After all, the specification may change as implementations reveal flaws, and we'd rather stick to describing things that are fairly reliable.

For quick reference purposes, Table 10-1 gives a quick summary of everything new in CSS2.

Table 10-1. New Properties in CSS2

New Properties in CSS2

text-shadow
font-size-
adjust
font-stretch
unicode-bidi
cursor
outline
outline-color
outline-style
outline-width
content
quotes
counter-reset
counter-increment
marker-offset
border-top-color
border-right-color
border-bottom-color
border-left-color
border-top-style
border-right-style
border-bottom-style
border-left-style
position
direction
top
right
bottom
left
z-index
min-width
max-width
min-height
max-height
overflow
clip
visibility
absolutely no effect on the line height. However, since borders arevisible, they'll be drawn -- as you can see for yourself inFigure 7-51.

Figure 7-51

Figure 7-51. Borders on inline elements

The borders have to go somewhere. This is where they went.

Again, all of this is only true for the top and bottom sides ofinline elements; the left and right sides are a different story.We'll start by considering the simple case of a small inlineelement within a single line, as depicted in Figure 7-52. page-break-before page-break-after page-break-inside orphans widows size marks border-collapse border-spacing table-layout

border-spacing
empty-cells
caption-side
speak-header-cell
volume
speak
pause-before
pause-after
pause
cue-before
cue-after
cue
play-during
azimuth
elevation
speech-rate
voice-family
pitch
pitch-range
stress
richness
speak-punctuation
speak-rate
speak-numeral
speak-time

New Pseudo-Classes and Pseudo-Elements in CSS2

:hover
:left
:right
:first
:before
:after

New @-rules in CSS2

@media
@font-face
@page

Table 10-2. New Values in CSS2

All Properties

inherit

The display Property

run-in
compact
marker
table
inline-table
table-row-group
table-column-group
table-header-group
table-footer-group
table-row
table-cell
table-caption 

The font Property

caption
icon
menu
message-box
small-caption
status-bar

The list-style-type Property

decimal-leading-zero
hebrew
georgian
armenian
cjk-ideographic
hiragana
katakana
hiragana-iroha
katakana-iroha
lower-greek

The color values

active-border
active-caption
app-workspace
background
button-face
button-highlight
button-text
caption-text
gray-text
highlight
highlight-text
inactive-border
inactive-caption
info-background
info-text
menu
menu-text
scrollbar
three-d-dark-shadow
three-d-face
three-d-highlight
three-d-lightshadow
three-d-shadow
window
window-frame
window-text

The vertical-align Property

length 


Library Navigation Links

Copyright © 2002 O'Reilly & Associates. All rights reserved.

wider when it hits 400 pixels. The appropriate styles are:

left: 0%; right: auto; width: 75%; max-width: 400px;

The great advantage of the min-max properties is that they let youmix units with relative safety. You can set percentage-based sizeswhile setting length-based limits, or vice versa.

TIP

These min-max properties can be very useful in conjunction withloated elements as well. For example, youA:link {color: #808080;} /* medium gray */ A.external:link {color: silver;} A:active {color: silver;} A:visited {color: #333333;} /* a very dark gray */

Figure 6-4

Figure 6-4. Changing colors of hyperlinks

This sets all anchors with the class external (<A CLASS="external" HREF="...">) to be silver, instead of medium gray. They'll still be a dark gray once they've been visited, of course, unless you add a special rule for that as well:

However, maybe we'd like to place the change marker next to whatever line was changed. In that case, we need to make only one small alteration to our styles, and we'll get the result shown in Figure 9-22:

SPAN.change {position: absolute; top: static-position; left: -5em; width: 4em;
font-weight: bold;}
P {margin-left: 5em; position: relative;}
<P> Lorem ipsum, dolor sit amet, consectetuer adipiscing elit,
sed diam nonummy nibh euismod tincidunt ut <SPAN CLASS="change">***</SPAN>
style sheet and hook that up using an @import
statement. Then place all of your Navigator-friendly margin rules
into another external style sheet and LINK it in.
( Just make sure your LINK comes before the
@import statement.) You'll end up with
something like this:

/* file 'link-styles.css' */        /* file 'import-styles.css' */
H1 {margin-bottom: 0;}              H1 {margin-bottom: 0;}
P {margin-top: -1em;}               P {margin-top: 0;}
adjacent list items is 15 pixels, not 25. This is because along the
vertical axis, adjacent margins are said to be collapsed. In other
words, the smaller of the two margins is eliminated in favor of the
larger. Figure 7-16 shows the difference between
collapsed and uncollapsed margins.

Figure 7-16

Figure 7-16. Collapsed versus uncollapsed margins

Correctly implemented user agents will collapse the vertically adjacent margins, as shown in the first list in Figure 7-16, where there are 15-pixel spaces between each list item. The second list shows what would happen if the user agent