Skip to content

Instantly share code, notes, and snippets.

View Schepp's full-sized avatar

Christian Schaefer Schepp

View GitHub Profile

Almost one year ago I wrote an article that dealt with an emerging WebKit CSS technique, the CSS filter effects, and the question if we could not have/emulate them in other browsers, too. Turned out we could.

Today I want to talk about another WebKit-only feature and show you how you might be able to use it across all of the browsers: This is about…

CSS Masks

CSS masks were added to the WebKit engine by Apple quite a while ago, namely back in April 2008. Masks offer the ability to control the opacity/transparency of elements on a per-pixel basis, similar to how the alpha/transparency-channel of "24-bit"-PNGs or 32-bit-TIFFs work.

[![RGBA](/content/home/003-css-masking/rgba.jpg)](/content/home/003-css-masking/rgba.jpg)
(function () {
var previousInputMode = false;
var inputMode = (function() {
try {
var inputMode = window.sessionStorage.getItem('inputMode');
if (!inputMode) {
return undefined;
}
if (window.ga) {
window.ga('set', 'dimension1', inputMode);