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

Link to comment
Share on other sites

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.

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • 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.