CSS Tip: DIV Loses Background With Float:Left
For some reason my mind cannot ever remember this when I come across this issue until I am pulling my hair out. So, I’m writing a post to both remind myself and hopefully help someone else out.
If you have created a DIV that has a CSS float:left; positioning element odds are, on occasion, you may encounter a tricky situation, especially in Firefox browser, in which your background seems to disappear.
The solution that works for me is a quick fix – add:
overflow: hidden;
To your PARENT DIV, not the current div that you are styling. This tells the parent div that you actually want the CHILD container to be the full width of the page.
There are a few other solutions. I found this to be the most useful article on the options today at least:
http://doctype.com/div-loses-inherited-background-color-after-adding-float











