<?xml version="1.0" encoding="UTF-8"?><rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
		>
<channel>
	<title>Comments on: Easy clearing of floats</title>
	<atom:link href="http://webstandardstips.com/2008/11/18/easy-clearing-of-floats/feed/" rel="self" type="application/rss+xml" />
	<link>http://webstandardstips.com/2008/11/18/easy-clearing-of-floats/</link>
	<description>Practical advice for building websites with web standards</description>
	<lastBuildDate>Sun, 07 Mar 2010 20:43:14 +0000</lastBuildDate>
	<generator>http://wordpress.org/?v=2.9.2</generator>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
		<item>
		<title>By: Isofarro</title>
		<link>http://webstandardstips.com/2008/11/18/easy-clearing-of-floats/comment-page-1/#comment-3</link>
		<dc:creator>Isofarro</dc:creator>
		<pubDate>Tue, 10 Feb 2009 10:35:33 +0000</pubDate>
		<guid isPermaLink="false">http://www.webstandardstips.com/?p=3#comment-3</guid>
		<description>Steve, &lt;code&gt;overflow: hidden&lt;/code&gt; is an excellent alternative for the reasons you cover. Thanks.

One pitfall or gotcha you need to watch out for using &lt;code&gt;overflow: hidden&lt;/code&gt; is that elements inside that container that are positioned absolutely and need to spill outside that container (like a JavaScript powered drop-down menu near the bottom of the container) get truncated/clipped to the &lt;code&gt;overflow: hidden&lt;/code&gt; styled container. It won&#039;t appear outside of the container at all because of the &lt;code&gt;overflow: hidden&lt;/code&gt;.

Other values of &lt;code&gt;overflow&lt;/code&gt; cater for this by applying scrollbars to the container, so the design goes right out of the window.

Still, if absolutely positioned child elements are not needed, &lt;code&gt;overflow: hidden&lt;/code&gt; is a great alternative to the &lt;code&gt;content:after&lt;/code&gt; self-clearing method.</description>
		<content:encoded><![CDATA[<p>Steve, <code>overflow: hidden</code> is an excellent alternative for the reasons you cover. Thanks.</p>
<p>One pitfall or gotcha you need to watch out for using <code>overflow: hidden</code> is that elements inside that container that are positioned absolutely and need to spill outside that container (like a JavaScript powered drop-down menu near the bottom of the container) get truncated/clipped to the <code>overflow: hidden</code> styled container. It won&#8217;t appear outside of the container at all because of the <code>overflow: hidden</code>.</p>
<p>Other values of <code>overflow</code> cater for this by applying scrollbars to the container, so the design goes right out of the window.</p>
<p>Still, if absolutely positioned child elements are not needed, <code>overflow: hidden</code> is a great alternative to the <code>content:after</code> self-clearing method.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Steve Webster</title>
		<link>http://webstandardstips.com/2008/11/18/easy-clearing-of-floats/comment-page-1/#comment-2</link>
		<dc:creator>Steve Webster</dc:creator>
		<pubDate>Mon, 09 Feb 2009 18:29:16 +0000</pubDate>
		<guid isPermaLink="false">http://www.webstandardstips.com/?p=3#comment-2</guid>
		<description>I prefer the following approach:

&lt;pre&gt;&lt;code&gt;
#wrapper {
   overflow: hidden;
   _zoom: 1
}
&lt;/code&gt;&lt;/pre&gt;

Of course, this only works on elements that don&#039;t have an explicit height, but is decidedly less fiddly. What&#039;s more, the above actually *contains* the float, rather than clears it, so you can style &lt;code&gt;#wrapper&lt;/code&gt; with the full knowledge that it&#039;ll contain its floated children.

The problem with the &lt;code&gt;:after&lt;/code&gt; fix is that designs tend to have a lot of elements that need clearing. One option to deal with this is to duplicate this fix multiple times for each element that needs to be cleared, resulting in CSS bloat. Alternatively, you could use a generic class selector (i.e. &#039;&lt;code&gt;clearfix&lt;/code&gt;&#039;) and apply that class to all the elements that need to be cleared, but that pollutes the markup with stylistic class names.

The above approach is short enough to be repeated multiple times and not make the CSS file unreadable. You do have to add a comment to make sure that other developers know what you&#039;re doing, though.</description>
		<content:encoded><![CDATA[<p>I prefer the following approach:</p>
<pre><code>
#wrapper {
   overflow: hidden;
   _zoom: 1
}
</code></pre>
<p>Of course, this only works on elements that don&#8217;t have an explicit height, but is decidedly less fiddly. What&#8217;s more, the above actually *contains* the float, rather than clears it, so you can style <code>#wrapper</code> with the full knowledge that it&#8217;ll contain its floated children.</p>
<p>The problem with the <code>:after</code> fix is that designs tend to have a lot of elements that need clearing. One option to deal with this is to duplicate this fix multiple times for each element that needs to be cleared, resulting in CSS bloat. Alternatively, you could use a generic class selector (i.e. &#8216;<code>clearfix</code>&#8216;) and apply that class to all the elements that need to be cleared, but that pollutes the markup with stylistic class names.</p>
<p>The above approach is short enough to be repeated multiple times and not make the CSS file unreadable. You do have to add a comment to make sure that other developers know what you&#8217;re doing, though.</p>
]]></content:encoded>
	</item>
</channel>
</rss>

