It seems to me that supporting IE limits your options quite a bit, namely that you must explicitly specify the height of the region.
In principle, you could write:
Code:
.container {
position: relative;
}
.background {
position: absolute;
top: 0;
bottom: 0;
left: 0;
right: 0;
opacity: 0.5;
filter: progid:DXImageTransform.Microsoft.Alpha(opacity=50);
}
HTML Code:
<div class="container">
<div class="background"></div>
<div class="container">
<!-- content -->
</div>
</div>
applying whatever background colour to the first div child element you liked. However, IE's poor CSS support means that it wouldn't cover the element. In fact, even specifying 100% for the height property (if the outer container had an explicit, non-percentage height) wouldn't force it to work. Instead, you would need to apply a length value in em or px units, which would be problematic for browsers that don't support the min-height property if the container could grow (it contained text, for example).
If this isn't essential, one alternative would be to use a PNG with alpha transparency. The style declaration that applied that background image could be overridden for IE to avoid that nasty grey, and work everywhere else (including IE7, which will support PNG images properly):
Code:
.faded-background {
background: #rrggbb url(alpha-background.png);
color: #rrggbb;
}
* html .faded-background {
background-image: none;
}
HTML Code:
<div class="faded-background">
<!-- content -->
</div>
The solid background colour you choose would either be a solid colour similar to the one used in the image, or transparent (if appropriate).
Mike
Bookmarks