This website may use cookies. More info. That's Fine x
Welcome Login

Setting background color in div with list items


Css

In Firefox, if you put a list into a div, and you want to add background color, be sure to set the height attibute of the div in css, otherwise you won't see the background color.

 

Reason why:

When you float the list items, they are moved out of the normal document flow, so what you are seeing in Firefox is a background color being applied to a <div> that has zero height. One way to get around thisis to set a height or a min-height on the ul


Created on: Friday, March 18, 2011 by Andrew Sin