Book HomeCascading Style Sheets: The Definitive GuideSearch this book Wednesday 16th of April 2014 06:04:03 PM

An easy way to remember the order in which sides have to be declared,other than thinking of it as being clockwise from the top, is to keepin mind that getting the sides in the correct order helps you avoid"trouble" -- that is, TRBL, for "Top RightBottom Left."

It's also possible to mix up the types of length value you use.You aren't restricted to using a single length type in a givenrule, as shown here:

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.

H1 {margin: 0.25in; background-color: silver;}
Figure 7-6

Figure 7-6. Setting a margin for H1 elements

This sets a quarter-inch of blank space on each side of an H1 element. In Figure 7-6, this is represented using dashed lines which are included for illustrative purposes. These lines would not actually appear in a web browser.

margin can accept any length measure, whether in pixels, inches, millimeters, or ems. However, the default value forno taller. This happens thanks to the revised rules for calculatingthe height and width of absolutely positioned elements, which werepublished in an errata to the original specification.

Note that the fact that we set an explicit width helped matters.Since the user agent knew how wide the element should be, it was atrivial matter to calculate the height of the element based on itscontent. If width has also been set to auto, thenthe user agent would have had to assign some value to it. This valueis likely to vary by user agent, so it's usually better toEven if clients don't support XML natively, it is not a big hindrance. In fact, Java with Servlets (on the server side) can convert XML with stylesheets to generate plain HTML that can be displayed in all web browsers.

Using XML to pass parameters and return values on servers makes it very easy to allow these servers to be web-enabled. A thin server side Java layer might be added that interacts with web browsers using HTML and translates the requests and responses from the client into XML, that is then fed into the server.

XML is totally extensible

By not predefining any tags in the XML Recommendation, the W3C allowed developers full control over customizing their data as they see fit. This makes XML very attractive to encoding data that already exists in legacy databases (by using database metadata, and other schema information). This extensibility of XML makes it such a great fit when trying to get different systems to work with each other.

XML supports shareable structure (using DTDs)

  • When an element has been absolutely positioned.

  • The default value of visible means that thecontent may be visible outside the element's box. Typically,this would lead to the content simply running outside its own elementbox, but not altering the shape of that box. The following styleswould result in Figure 9-8: