BODY {color: black; background-color: white;}P {color: #333;}PRE, CODE, TT {color: rgb(50%,50%,50%); background-color: #FFFFCC;}A:link {color: blue; background-color: yellow;}A:visited {color: navy; background-color: white;}
Figure 6-20

Figure 6-20. The results of a more sophisticated style sheet

This is but the tiniest beginning of what's possible, ofcourse. By all means, try some examples of your own!

wohnung Tuesday 26th of September 2017 07:31:48 AM

by Eric A. Meyer
ISBN 1-56592-622-6
First edition, published May 2000.
(See the
catalog page for this book.)

Search the text of Cascading Style Sheets: The Definitive Guide.

Table of Contents

Copyright Page
Chapter 1: HTML and CSS
Chapter 2: Selectors and Structure
Chapter 3: Units and Values
Chapter 4: Text Properties
Chapter 5: Fonts
Chapter 6: Colors and Backgrounds
Chapter 7: Boxes and Borders
Chapter 8: Visual Formatting
Chapter 9: Positioning
Chapter 10: CSS2: A Look Ahead
Chapter 11: CSS in Action
Appendix A: CSS Resources
Appendix B: HTML 2.0 Style Sheet
Appendix C: CSS1 Properties
Appendix D: CSS Support Chart
Library Navigation Links

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

complicated. Fortunately, it starts out simply enough; it'sonly when you start putting things together that the situationbecomes difficult.

First off, the simplest rule is this: unlike vertical margins,horizontal margins are notcollapsed. If you somehow manage to have two block-level elementsnext to each other, and each has a margin, the margins will notcollapse. The easiest way to illustrate this principle is to set immediately follows another such element in the document'slayout. This was discussed in the previous chapter, using thisexample:

LI {margin-top: 10px; margin-bottom: 20px;}

Padding and borders, where they exist, are never collapsed. Ifneither is declared, then both will default to 0(zero). This assumes that no style is set for the border. If a borderstyle is set, then the value of border-widthdefaults to medium , not zero. The exact width of



Applies to
we'll discuss later in the chapter. Falling back on solid

There is one interesting thing about CSS that can make life difficultfor authors. According to CSS1, a user agent is allowed to interpretany value of border-style (besidesnone) as solid. Because of thisallowance, a user agent that is technically CSS1-compliant could 0 for left keeps the left edge of the clipping rectangle against the left edge of the image, but the 10px for top moves the top edge of the clipping rectangle downward 10 pixels. This will cause the top 10 pixels of the image to become effectively invisible.

clip can be applied to any element. Thus, you could display only the top left corner of a paragraph using something like this: