Forum Moderators: not2easy

Message Too Old, No Replies

Background not displaying in firefox

         

harryhermit

9:16 am on Jul 7, 2006 (gmt 0)

10+ Year Member



Hi, I'm trying to figure out why this isn't working. Basically I have a div container that is positioned relative. Inside the div I have three divs floated left. When I set either a background color or background image on the container, it shows up in IE but not firefox. Any reason for this?

Robin_reala

10:51 am on Jul 7, 2006 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



Your container is collapsing because you've floated all the contents. Try:

1) Floating the container as well
2) Setting a value of overflow to auto or hidden on the container.
3) Use the 'Easy Clearing' technique:

div#container { content: "."; clear: both; display: block; visibility: hidden; height: 0; }

Number 3 only works in more advanced browsers (ie. not IE) but you can use it's hasLayout property for the same effect - if you're not seeing this problem in IE then you're already inadvertantly triggering it.