Tuesday 23rd of September 2014 02:18:44 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
Preface
Chapter 1: HTML and CSS
Chapter 2: Selectors and Structure

If you have documents in which there is a certain block ofcommon markup -- say, a table thatholds links to the main pages of your site -- it's easy tostyle them without having to change the HTML markup on each page.

Let's assume we have a table of links like this one:

<TABLE BORDER CELLPADDING="4"><TR>
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
Index
Colophon
Library Navigation Links

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

The only drawback to this ability is a small one, but you're bound to run into it eventually. Suppose you want to set the top and left margins for H1 elements to be 10 pixels, and the bottom and right margins to be 20 pixels. In that case, you have to write the following:

H1 {margin: 10px 20px 20px 10px;} /* can't be any shorter */

Unfortunately, there is no way to cut down on the number of values needed in such a circumstance. may vary by user agent.

Example

text-indentIE4 Y/Y IE5 Y/Y NN4 Y/Y Op3 Y/-

Used to set the indentation of the first line of an element. This is most often used to create a tab effect for Negative values are permitted, and cause "hanging indents."

text-transformIE4 Y/Y IE5 Y/Y NN4 Y/Y Op3 P/-

This property changes the case of the letters in the element, regardless of the case of the original text.

margin can accept any length measure, whether inpixels, inches, millimeters, or ems. However, the default value formargin is effectively 0 (zero),which means that if you don't declare a value, then by default,there won't be a margin.

TIP

In practice, browsers come with pre-assigned styles for manyelements, and margins are no exception. For example, in CSS-enabledbrowsers, the "blank line" above and below each paragraph upper-roman | lower-roman | none

The meaning of these values is shown in Table 7-1.

Table 7-1. Values of the list-style property and their results

These properties can only be applied to any element that has a display of list-item , of but it's valid behavior.

Let's consider another example, illustrated in Figure 8-20, where the left margin is set to be negative:

DIV {width: 400px; border: 1px solid black;}P.wide {margin-left: -50px; width: auto; margin-right: 10px;border: 3px solid gray;}
Figure 8-20

Figure 8-20. Setting a negative left margin

In this case, not only does the paragraph spill beyond the borders ofthe DIV, but also beyond the edge of the browser