How can I make my background transparent without the text being transparent?
p{
font-family:sans-serif, Times;
color:#666666;
opacity:0.5;
background-color:#00C72E;
width: 50%;
font-size:16px;
margin:0px;
}
You're going to want to use rgba
colors to accomplish this. Something like this should work for you:
p {
font-family:sans-serif, Times;
color:#666666;
background-color:rgba(0,199,46,.5);
width: 50%;
font-size:16px;
margin:0px;
}
Here is a fiddle: http://jsfiddle.net/Ty632/
opacity:0.5;
changes the opacity of the container and the content within it.
You can use and RBGA background color (background-color:rgba(0,199,46,0.5);
), which is and RGB value with an opacity element at the end, but it isn't very backwards compatible. More information on RGBA colors , including a browser compatibility chart, can be found here: http://css-tricks.com/rgba-browser-support/
Another option is to use a semi-transparent PNG as a background, which will work on most modern web-browsers. You can find a browser compatibility chart for semi-transparent PNG images here: http://caniuse.com/png-alpha