Book HomeCascading Style Sheets: The Definitive GuideSearch this book Sunday 25th of February 2018 10:22:39 PM

8.5. Summary

Although some aspects of the CSS formatting model may seem counterintuitive at first, they begin to make sense the more one works with them. In many cases, what seem like nonsensical or even idiotic rules turn out to exist in order to prevent bizarre or otherwise undesirable document displays.

of H2 elements, as shown in Figure 7-75.

Figure 7-75

Figure 7-75. Clear to the left, but not the right

To avoid this sort of thing, and to make sure thatH2 elements do not coexist on a line with anyfloated elements, we use the value both. Thisvalue prevents coexistence with floated elements on both sides of theelement, as shown in Figure 7-76:

H2 {clear: both;}

As it happens, having a firm grasp of the visual formatting model is a good foundation for understanding how positioning works. Thus, the next chapter will cover positioning, and do so in a manner very similar to this chapter: the discussion is largely theoretical.

Library Navigation Links

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

.navbar {background: green; padding: 0; margin: 0 0 10px 0; width: 100%;}

Now everything should be set for the navigation bar, as we can see inFigure 11-4. All we need to do now is make sure themain display has some blank space to its left, and we're done.

Figure 11-4

Figure 11-4. The greening of the navigational bar

No doubt you already know how this will work. We create anotherdivision, this one classed as main and enclosingeverything in the main part of the page that isn't thenavigation bar. Then we declare:BIG element to be displayed without overlapping any other text and without changing the line-height of all lines in the paragraph. We use a value 1em so that the line-height for the BIG element will be set to the same size as BIG's font-size -- remember, line-height is set in relation to the font-size of the element itself, not the parent element.

SAX, DOM and XML are very developer friendly because developers are going to decide whether this technology will be adopted by the majority and become a successful effort towards the goal of interoperable, platform, and device independent computing.

XML is web enabled

XML is derived from SGML, and so was HTML. So in essence, the current infrastructure available today to deal with HTML content can be re-used to work with XML. This is a very big advantage towards delivering XML content using the software and networking infrastructure already in place today. This should be a big plus in considering XML for use in any of your projects, because XML naturally lends itself to being used over the web.

Even 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.

sides of an element on which no floating images may be placed. The effect of this is to move the element downward until the top of its border-edge is below the bottom edge of the floated element.


H1 {clear: right;}


none | left | right | both