Jump to content

Div transparency


atholon

Recommended Posts

Hi,

 

I am trying to make a div have a semi transparent background using the filter and moz property on that div. The problem is is that it is making all the text and images placed inside of that div also transparent.

 

Is there a way to fix that and just make the background itsself transparent?

Link to comment
Share on other sites

I don't think so. I think the general idea of opacity is that everything is that opacity. You could do something like...have a div with a background and an opacity, then a div with the text in on top of the other div, with an absolute position and z-index: 1. Something like that anyway.

Link to comment
Share on other sites

Using {opacity:1;} (because opacity is now fully supported by mozilla) won't work because it will only be 100% opacity that is inherited from the parent.

 

If by semi transparent background you mean only semi transparent background colour, then you can use:

 

{background:#000; background:rgba(0,0,0,0.5);}

 

rgba is supported by all mozilla and webkit browsers. Declare a background colour before the rgba declaration to act as a fallback for any browsers that don't support rgba. In the rgba declaration the first 3 values are the rgb values and the last is the alpha value.

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.