HTML and CSS Reference
In-Depth Information
Tip So you want to filter a style that only IE/Mac can see? Thanks to Doug Bowman and Tantek Çelik,
there's a solution: . What's that? You need to filter an entire
style sheet to IE/Mac? There's something for you, too, courtesy of Geoff Sheridan:
cssd/ie51-only.html .
Easy Float Clearing
If you've worked with CSS layouts for any length of time, you've probably encountered the issue
of float clearing, especially for columnar layouts. Until recently, the standard method involved
inserting something like <div style="clear:both;"></div> as the last element within a con-
tainer div surrounding the floats, but that's a nasty way to accomplish the task. Now, thanks to
Tony Aslett ( ) and the fine folks at , we have
a better way.
Here we have a container div , a floated box, and a few block elements following the float:
<div class="container">
<div class="floatedbox">
<p>floated box</p>
<h3>Container 1</h3>
<p>(<em>without</em> easy clearing)</p>
And let's add a few styles for visual clarity:
.container {
border:3px solid #ddd;
.floatedbox {
padding:0 10px;
border:3px solid #bbb;
This gives us the result shown in Figure 6-2. Since the float isn't cleared and is taller than the
containing element, it extends below the bottom border of its container div .
Search WWH ::

Custom Search