Jump to content

need help with css opacity


PHPJack77

Recommended Posts

Hi guys,I'm currently trying to create a div tag that will be at 50% opacity, and I want the text inside the div to be at 100% opacity.I can get the div tag to show properly at 50% opacity using the following code in my style sheet:filter: alpha(opacity=50);However, the text inside the div tag also shows up at 50%, not 100%Can someone please help me correct this? Thanks!!

Link to comment
Share on other sites

Ok. First of all, your filter: thing will only work in IE. The cross-browser way to do it:opacity:.50;filter: alpha(opacity=50); -moz-opacity: 0.50;Put that in your stylesheet. Now, onto doing it.What you can do is put another div inside your transparent div. Make sure both divs have a margin and padding of 0px. For the inner div, your stylesheet would look like this:

.outerDiv {  padding:0px;  opacity:.50;  filter: alpha(opacity=50);   -moz-opacity: 0.50;  background-color: #000000;}.innerDiv {  padding: 0px;  margin: 0px;  background:tranparent;  color: #000000;  opacity:1;  filter: alpha(opacity=100);   -moz-opacity: 1;}

Hope that helps. I'm not sure if the child div will inherit the opacity of the parent div. :)Choco

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...