Different transparency rendering in firefox

Firefox renders transparency in gradients different than webkit. The trick is to not use transparent or rgba(0,0,0,0). Instead use the first color with alpha transparency = 0.

by WebCore_IT

HTML

<h1>Different transparency rendering in firefox</h1>
<section>
    <div class="gray"><h2>gray</h2></div>
    <div class="color"><h2>color</h2></div>
</section>

CSS

section {
    background: hsla(150,100%,90%,1);
    height: 240px;
}
div {
    text-align: center;
    width: 200px;
    height: 200px;
    float: left;
    margin: 1em;
    border: 1px solid black;
}
div.gray {
    background: linear-gradient(0deg,  hsla(0,100%,50%,1) 0%, transparent 100%);
}
div.color {
    background: linear-gradient(0deg,  hsla(0,100%,50%,1) 0%, hsla(0,100%,50%,0) 100%);
}

JavaScript

// You need Firefox 16+ to see the difference.

/*
Firefox renders transparency in gradients different than webkit. 

The trick is to not use transparent or rgba(0,0,0,0).
Instead use the first color with alpha transparency = 0.
*/