Book HomeCascading Style Sheets: The Definitive GuideSearch this book Sunday 18th of March 2018 03:07:05 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, horizontal margins are notcollapsed. If you somehow manage to have two block-level elementsnext to each other, and each has a margin, the margins will notcollapse. The easiest way to illustrate this principle is to setmargins on two images and then have them appear on the same line, asthey do in Figure 8-6:

<IMG SRC="test1.gif" STYLE="margin: 5px;" ALT="first test"><IMG SRC="test2.gif" STYLE="margin: 5px;" ALT="second test">
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.

This makes good sense, since if you declare P {color: maroon;}, you probably expect that any text within that paragraph will also be maroon, even if it's emphasized or boldfaced or whatever. Of course, if you want such elements to be different colors, that's easy enough, as illustrated by Figure 6-9:

P {color: maroon;}
EM {color: #999999;}
Figure 6-9

Figure 6-9. Different colors for different elements

In Figure 8-46, the borders for each line of textalso happen to coincide with the top and bottom of each line box.This is only true because no padding or line height has been set forthe inline text, but for the moment, let's use the visual cuefor reference. Also, notice that the borders actually overlap eachother slightly: for example, the bottom border of the first line isjust below the top border of the second line. This is because theborder is actually drawn on the next pixel (assuming we'reusing a monitor) to the outside of each line