Chapter 4. Creative Floating


Use floats to achieve grid-like results.

In previous chapters, we started each bulletproof approach by first deciding how the component we're dealing with should be structuredthat is, what markup is most appropriate for the content being displayed? This, I believe, is an important step when building any Web site. With a goal of selecting elements that convey the most meaning to what they surround, you hope to be left with enough "style hooks" to apply a compelling design with CSS. But more importantly, choosing the best markup for the job means the content of the page has the best chance of being understood properly across the widest possible range of browsers and devices. It's the foundation and should convey a clear message, regardless of the design applied on top of it via CSS. Additionally, if we take time to consider optimal structure (meaningful XHTML) and design (CSS) separately, changing that design later on down the road becomes less like finding a needle in a haystack and more like changing the slipcover on a sofa.

Settling on an optimal structure doesn't have to limit the way it's displayed, however. As we'll explore in this chapter, the creative use of the float property can give us grid-like resultswith a fraction of the code we'd need with the nested-tables approach. By paring down the markup to its barest essentials, we make it easier for browsers, software, and all devices to read our contentat the same time making it easier for other designers and developers to modify and edit these components.

We start this chapter off by rebuilding a box containing multiple pairings of an image, title, and description. This is a common layout requirement found on sites all over the Web, and one that we can handle elegantly using minimal markup and CSS.



Bulletproof Web Design(c) Improving flexibility and protecting against worst-case scenarios with XHTML and CSS
Bulletproof Web Design(c) Improving flexibility and protecting against worst-case scenarios with XHTML and CSS
ISBN: N/A
EAN: N/A
Year: 2006
Pages: 97

flylib.com © 2008-2017.
If you may any questions please contact us: flylib@qtcs.net