This question already has an answer here:
Can I assign the opacity
property to the background
property of a div
only and not to the text on it?
I've tried:
background: #CCC;
opacity: 0.6;
but this doesn't change the opacity.
This question already has an answer here:
Can I assign the opacity
property to the background
property of a div
only and not to the text on it?
I've tried:
background: #CCC;
opacity: 0.6;
but this doesn't change the opacity.
This will work with every browser
If you don't want transparency to affect the entire container and it's children, check this workaround. You must have an absolutely positioned child with a relatively positioned parent to achieve this. http://www.impressivewebs.com/css-opacity-that-doesnt-affect-child-elements/
Check working demo at http://www.impressivewebs.com/demo-files/css-opacity/css-opacity-demo.html
I had the same problem. I want 100% Transparent background color, Just use this code, its worked great for me:
You can see examples on the left side on this web page (the contact form area)
The easiest way to do this is with 2 divs, 1 with the background and 1 with the text:
The easiest solution is to create 3
divs
. One that will contain the other 2, the one with transparent background and the one with content. Make the first div's position relative and set the one with transparent background to negativez-index
, then adjust the position of the content to fit over the transparent background. This way you won't have issues with absolute positioning.My trick is to create a transparent .png with the color and use
background:url()
.