Monday 31st of August 2015 03:12:01 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.

these rules:

H1 {margin-bottom: 0;}P {margin-top: 0;}

For Navigator, though, you have to set the top margin of theparagraph to be -1em to get the same effect, whichwill hopelessly mangle Explorer's display of the document. Howto resolve the conflict?

First, place all your Navigator-unfriendly rules into an external

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.

3.1.1. Named Colors

Assuming that you're happy with picking from a small, basic setof 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,links to be medium gray and others a relatively dark gray, youcouldn't do that with the BODY attributes.Instead, you'd have to use <FONTCOLOR="#666666"> on every single anchor thatneeded to be relatively dark. Not so with CSS; all you need to do isadd a class to all anchors that need to be this shade of gray andmodify your styles accordingly, with the result seen in Figure 6-4:

BODY {color: black;}A:link {color: #808080;}      /* medium gray */side of an element. That's simple as well. If we want all
H1 elements to have a top margin of 10 pixels, a
right margin of 20 pixels, a bottom margin of 15 pixels, and a left
margin of 5 pixels, here's all we need:

H1 {margin: 10px 20px 15px 5px; background-color: silver;}

As Figure 7-8 reveals, we have what we wanted. The order of the values is obviously important, and follows this pattern:

margin: top right bottom left

The styles between the opening and closing STYLE tags are referred to as the document style sheet or the embedded style sheet , since this style sheet is embedded within the document. It contains styles that apply to the document, but it can also contain multiple links to external style sheets using the @import directive.