Skip to content

Instantly share code, notes, and snippets.

@parrfolio
Created September 14, 2011 05:45
Show Gist options
  • Select an option

  • Save parrfolio/1215936 to your computer and use it in GitHub Desktop.

Select an option

Save parrfolio/1215936 to your computer and use it in GitHub Desktop.
CSS3 Text Mask for Firefox
body {
background: #444;
}
h2 {
font-size:68px;
color:#f1f1f1;
position:relative;
z-index:1;
font-family:helvetica, arial, sans-serif;
}
h2:after {
color:#666;
content: 'Firefox Text Mask';
position:absolute;
left:0;
opacity:1;
z-index:100;
margin-top:-1px;
margin-left:-1px;
mask: url('mask.svg#mask');
text-shadow:0 1px 3px #000;
}
h2:before {
color:#222;
content: 'Firefox Text Mask';
position:absolute;
left:0;
margin-top:1px;
margin-left:1px;
z-index:1020;
mask: url('mask.svg#mask');
}
<h2>Firefox Text Mask</h2>
<?xml version="1.0" encoding="UTF-8"?>
<svg version="1.1" xmlns="http://www.w3.org/2000/svg">
<defs>
<linearGradient gradientUnits="objectBoundingBox" id="gradient" x2="0" y2="1">
<stop stop-offset="0" />
<stop stop-color="white" offset="1"/>
</linearGradient>
<mask id="mask" maskUnits="objectBoundingBox" maskContentUnits="objectBoundingBox" x="0" y="0" width="100%" height="100%">
<rect width="1" height="1" fill="url(#gradient)"/>
</mask>
</defs>
</svg>
<!-- SVG file needs to be on the same domain -->
<?xml version="1.0" encoding="UTF-8"?>
<svg version="1.1" xmlns="http://www.w3.org/2000/svg">
<defs>
<linearGradient gradientUnits="objectBoundingBox" id="gradient" x2="0" y2="1">
<stop stop-offset="0" />
<stop stop-color="white" offset="1"/>
</linearGradient>
<mask id="mask" maskUnits="objectBoundingBox" maskContentUnits="objectBoundingBox" x="0" y="0" width="100%" height="100%">
<rect width="1" height="1" fill="url(#gradient)"/>
</mask>
</defs>
</svg>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment