[X]

The Opacity Four-Pack

layout hacks 2003 partly

Before one opacity property worked everywhere, every faded box carried the real opacity line plus four legacy fallbacks and hoped one of them stuck.

In 2026: Partly. Exactly one line does the work now: opacity. The Mozilla, KHTML and Internet Explorer alpha() versions all parse to nothing, so the box below is forty percent opaque by the strength of a single modern property standing where four used to crowd. The IE filter line is why so many old pages had jagged text on faded elements.

Where it came from: The cross-browser opacity incantation of roughly 2003. Only the unprefixed property, standardised in CSS Color 3, still functions. MDN

<style>
.ghost {
  opacity: 0.4;                                 /* the standard, and the survivor */
  -moz-opacity: 0.4;                            /* Netscape 6 / early Firefox      */
  -khtml-opacity: 0.4;                          /* Safari's Konqueror-era engine   */
  filter: alpha(opacity=40);                    /* Internet Explorer 4 to 8        */
  -ms-filter: "progid:DXImageTransform.Microsoft.Alpha(Opacity=40)"; /* IE8 */
  background: #cc0000; color: #fff; padding: 20px;
}
</style>

<div class="ghost">Forty percent opaque. One line of five is doing it.</div>
sandboxed demo · breaks nothing but itselfrestart

More in layout hacks

all 20 in layout hacks › · the whole library ›