Clearing floats with overflow:auto

  • 28th February 2005
  • with Comments off for Clearing floats with overflow:auto
  • Filed Under: Weblog
  • tagged with: css

I've been using the Position is Everything Float Clearing method in production for a while now. Getting the clearing divs out of my markup was very satisfying, in a geeky sort of way. The method is fiendishly clever... so much so that I felt no shame in not having thought of it myself. I just read Simple Clearing of Floats by Alex Walker though and I was left gaping at the screen, reading and re-reading the article. Apparently just putting overflow: auto on the parent container of your floats will sort out all your clearing issues. It's that simple. Bloody hell.

  • Comments off for Clearing floats with overflow:auto