.outer {
position: relative
}
.background {
position: absolute;
top: 0;
left: 0;
width: 100%;
height: 100%;
background-color: #000; /* Or whatever */
opacity: 0.6;
-moz-opacity: 0.6;
filter: alpha(opacity=60);
}
<div class="outer">
<div class="background"></div>
Content
</div>
Note that sometimes the height: 100%
rule for .background
doesn't work in IE 6, in which case you should try applying hasLayout
to first .outer
, and if that fails to .background
as well (you can add hasLayout
with the CSS rule zoom: 1
without side-effect). If neither of those works, you'll likely need an expression
value for IE 6. If you need further help leave a comment.
As smerriman said, it's much simpler in browsers which support CSS3 (more specifically, rgba
or hsla
color values). It would be as simple as background-color: rgba(0, 0, 0, 0.6)
.