Posted: 4 years ago

Filed under: CSS

Tagged with:

Follow comments

Containing floats in block elements

I just wanted to bookmark a really useful page about how to make block elements in CSS expand to contain floated elements.

There are a couple of suggested ways to deal with this on the page but the one I needed today was adding an element to the end of the float that has the style

  1. <div id="outer">
  2.     <img src="elephant.jpg" style="float: left"/>
  3.     <div style="clear: left;"></div>
  4. </div>

Leave a Reply