Jump to content

Opaque image on a transparent background


superdan_35

Recommended Posts

I have recently changed the design of a site to incorporate a transparent background in div containers using the new CSS3 styles. The only problem is that any images I have within these div containers also become transparent.

 

The page in question is a div container with a table inside. The image (a jpeg with solid white background) is placed inside the table with a div of it's own for styling. I have tried setting opacity for the image div as well as background colours and images, none of which work. I have also tried to give the table cell a background colour.

 

Any ideas would be brilliant!

 

Thanks,

Dan

An element cannot have an opacity higher than that of its parent. So if the parent has 50% opacity, then any elements inside that will only have 50% opacity, even if they are set to 100%.

 

To get around this, you can use a transparent background image for the container, instead of setting the opacity with CSS. You will have to use a pngfix script if you want it to work in IE6 though.

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.