Skip to content

Instantly share code, notes, and snippets.

@pads
Last active December 18, 2015 16:39
Show Gist options
  • Save pads/5813236 to your computer and use it in GitHub Desktop.
Save pads/5813236 to your computer and use it in GitHub Desktop.
A collection of CSS hacks
/* For IE7 & 8 */
.transparent-black {
/* IE7 needs an element to be positioned in order to apply a transparent background, this is a work-around */
zoom: 1;
background-color: #000;
filter: alpha(opacity=70);
/* Fill the parent container */
position: absolute;
top: 0;
left: 0;
height: 100%;
width:100%;
}
/* For all other browsers - requires modernizr */
.rgba .transparent-black {
background: rgba(0, 0, 0, 0.7);
}
<section style="position: relative;">
<div class="transparent-black"></div>
<!-- Other stuff that won't end up transparent -->
</section>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment