Monday 19th of March 2018 10:49:56 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
property, which is a very common practice:

BODY {background: white;}

This is perfectly legal, and in some ways preferred, given thereduced number of keystrokes. In addition, it has the effect ofsetting all of the other background properties to their defaults,which means that background-image will be set tonone. This helps ensure readability by preventingother rules (in, for example, the reader style sheet) from setting animage in the background. 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.

suffice, as we can see in Figure 7-42:

H1 {border-style: solid; border-width: thin thick; border-color: black gray;}
P {border-style: solid; border-color: gray;}
Figure 7-42

Figure 7-42. Borders have many aspects

By default, a single color value will be applied to all four sides, as with the paragraph in the previous example. On the other hand, if you supply four color values, you can get a different color on each side. Any type of color value can be used, from named colors to hexadecimal and RGB values. wholly transparent, and this will cause the image to be combined with the background color. In addition, if the image fails to load for some reason, the user agent will use the background color specified in place of the image. Consider how the "starry paragraph" example would look if the background image failed to load, as in Figure 6-26.

Figure 6-26

Figure 6-26. The consequences of a missing background image

Given this reason alone, it's always a good idea to specify a background color when using a background image, so that your white of colors, then the easiest method is to simply use the name of thecolor you want. These are referred to, unsurprisingly enough, asnamedcolors.

Contrary to what some browser companies might have you believe, youare limited in the range of named colors available. For example,setting a color to "mother-of-pearl" isn't going towork, because it isn't a defined color. (Well, not yet, at any

In order to combat this problem, it is recommended that you enclose your declarations in a comment tag. In the example given here, the beginning of the comment tag appears right after the opening STYLE tag, and the end of the comment appears right before the closing STYLE tag:

<STYLE type="text/css"><!--
@import url(sheet2.css);
H1 {color: maroon;}