Friday 03rd of July 2015 10:13:47 PM

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

The very first paragraph is italicized because it is the first child of the BODY element. Similarly, the first paragraph in the first DIV is italicized because it is the first child of the DIV, even though text preceded it. Only structural elements count for this pseudo-class, so the text before the paragraph doesn't affect the paragraph's status as the first child. However, in the second DIV, the H2 is the first child, so it does not match the rule P:first-child. If the intent is to have the first child of any element be italicized,

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

You guessed it: there are properties that let you set the padding on a single side of the box, without affecting the other sides.

padding-top, padding-right, padding-bottom, padding-left


<length> | <percentage>

BODY {background-image: url(bigyinyang.gif);
background-repeat: no-repeat;
background-position: 33%;}

The background image is placed one-third of the way across the page, and halfway down it, as depicted in Figure 6-42.

Figure 6-42

Figure 6-42. Declaring only one percentage means the vertical position evaluates to 50%

Table 6-2 gives a breakdown of keyword and percentage equivalencies.