Book HomeCascading Style Sheets: The Definitive GuideSearch this book Sunday 04th of December 2016 04:50:40 AM

Copyright © 2000 O'Reilly & Associates, Inc. All rights reserved.

Printed in the United States of America.

Published by O'Reilly & Associates, Inc., 1005 Gravenstein Highway North, Sebastopol, CA 95472.

Nutshell Handbook, the Nutshell Handbook logo, and the O'Reilly logo are registered trademarks of O'Reilly & Associates, Inc. Many of the designations used by manufacturers and sellers to distinguish their products are claimed as trademarks. Where those designations appear in this book, and O'Reilly & Associates, Inc. was aware of a trademark claim, the designations have been printed in caps or initial caps. The association between the image of a koala and the topic of HTML and XHTML is a trademark of O'Reilly & Associates, Inc.

While every precaution has been taken in the preparation of this book, the publisher assumes no responsibility for errors or omissions, or for damages resulting from the use of the information contained herein.

Library Navigation Links

Copyright © 2002 O'Reilly & Associates. All rights reserved. Scaling the line heights

There's an even better way to setline-height, as it turns out, and that's touse a raw number as the value of line-height. Thisis so much better because the number is used as a scaling factor, andit is the factor that is inherited, not the computed value.Let's say you want the line-height of allelements in a document to be one-and-one-half times their

On the other hand, perhaps you wish to make purple any element thatis a descendant of DIV. This would be written:

DIV * {color: purple;}

At first glance, this seems no different than if the* were left out, instead relying on inheritance tocarry the color to all descendants ofDIV. However, there is a very real difference: therule shown would match every DIV descendant, andtherefore override the inheritance mechanism. Thus, even anchorsbackground-position: -150px -100px;}

Figure 6-46

Figure 6-46. Another set of negative lengths

Negative percentages are also possible in theory, although there aretwo issues involved. The first is the limitations of user agents,which may not recognize negative values forbackground-position. The other is that negativepercentages are somewhat interesting to calculate. Figure 6-47 shows why.

Figure 6-47

Figure 6-47. Aligning negative percentage points: two scenarios

This isn't to say that you shouldn't use negative values, Good background practices

An interesting thing about images is that they're laid on top of whatever background color you may have specified. If you're completely tiling GIF, JPEG, or other opaque image types, this doesn't really make a difference, since they'll fill up the document background, leaving nowhere for the color to "peek through," so to speak. However, image formats with an alpha channel, such as PNG, can be partially or