CSS

Screen shot 2012-06-26 at 12.27.44 AM

Clearing Floated Elements

June 26, 2012
343 Views

When a floating element is bigger than the containing element, some pretty weird things can happen.

To avoid layout errors, make sure to put this line of code before the closing tag of the containing element.

<br style="clear:both;" />

for example,

<div>
<img src="myimg.jpg" alt="my  image" style="float:left;" />
<p>just some example text to get my point across.</p>
<br style="clear:both;" />
</div>

Web Designer from Kalamazoo, Michigan. Loves Food, Traveling, Photography, WordPress, Health and Growing Businesses!

Leave A Comment