So I am having a problem. I have looked around and looked around but no luck. I would like to make the background of my body transparent but leave the text non transparent.
For a fully transparent background use:
background: transparent;
Otherwise for a semi-transparent color fill use:
background: rgba(255,255,255,0.5); // or hsla(0, 0%, 100%, 0.5)
where the values are:
background: rgba(red,green,blue,opacity); // or hsla(hue, saturation, lightness, opacity)
You can also use rgba values for gradient backgrounds.
To get transparency on an image background simply reduce the opacity of the image in an image editor of you choice beforehand.
opacity
will make both text and background transparent. Use a semi-transparent background-color instead, by using a rgba()
value for example. Works on IE8+
box-shadow: inset 1px 2000px rgba(208, 208, 208, 0.54);
If you use RGBA for modern browsers you don't need let older IEs use only the non-transparent version of the given color with RGB.
If you don't stick to CSS-only solutions, give CSS3PIE a try. With this syntax you can see exactly the same result in older IEs that you see in modern browsers:
div {
-pie-background: rgba(223,231,233,0.8);
behavior: url(../PIE.htc);
}
Don't use opacity
for this, set the background to an RGBA-value instead to only make the background semi-transparent. In your case it would be like this.
.content {
padding:20px;
width:710px;
position:relative;
background: rgb(204, 204, 204); /* Fallback for older browsers without RGBA-support */
background: rgba(204, 204, 204, 0.5);
}
See http://css-tricks.com/rgba-browser-support/ for more info and samples of rgba-values in css.