Pen Settings



CSS Base

Vendor Prefixing

Add External Stylesheets/Pens

Any URLs added here will be added as <link>s in order, and before the CSS in the editor. You can use the CSS from another Pen by using its URL and the proper URL extension.

+ add another resource


Babel includes JSX processing.

Add External Scripts/Pens

Any URL's added here will be added as <script>s in order, and run before the JavaScript in the editor. You can use the URL of any other Pen and it will include the JavaScript from that Pen.

+ add another resource


Add Packages

Search for and use JavaScript packages from npm here. By selecting a package, an import statement will be added to the top of the JavaScript editor for this package.


Save Automatically?

If active, Pens will autosave every 30 seconds after being saved once.

Auto-Updating Preview

If enabled, the preview panel updates automatically as you code. If disabled, use the "Run" button to update.

Format on Save

If enabled, your code will be formatted when you actively save your Pen. Note: your code becomes un-folded during formatting.

Editor Settings

Code Indentation

Want to change your Syntax Highlighting theme, Fonts and more?

Visit your global Editor Settings.


                <h1 class="headline">-webkit-background-clip: text | Polyfill</h1>

    <a href="" target="_blank">Fork it on GitHub</a>
    2013 by <a href="" target="_blank">@TimPietrusky</a>


                @import "compass/css3";

body {
  font: 1em sans-serif;
  margin:0 1em;

h1 {
  color: red;
  -webkit-text-fill-color: transparent;
  background: -webkit-linear-gradient(transparent, transparent),
             url( repeat;
  background: -o-linear-gradient(transparent, transparent);
  -webkit-background-clip: text;

 * This style will be shared with the SVG because
 * I have to replace the DOM element in Firefox. 
 * Otherwise the SVG pattern will be broken.
.headline {
  font: bold 2.25em sans-serif;

svg {
  height: 8em;
  width: 100%;

 * Just some styling... ignore it
article {
  border-top:.15em solid #7BB03B;

a {
  transition:color .15s ease-in-out;
  &:hover {


  -webkit-background-clip: text Polyfill
  # What? #
  A polyfill which replaces the specified element with a SVG
  in browser where "-webkit-background-clip: text" 
  is not available.

  Fork it on GitHub

  # 2013 by Tim Pietrusky

Element.prototype.backgroundClipPolyfill = function () {
  var a = arguments[0],
      d = document,
      b = d.body,
      el = this;

  function hasBackgroundClip() {
    return != undefined;
  function addAttributes(el, attributes) {
    for (var key in attributes) {
      el.setAttribute(key, attributes[key]);
  function createSvgElement(tagname) {
    return d.createElementNS('', tagname);
  function createSVG() {
    var a = arguments[0],
        svg = createSvgElement('svg'),
        pattern = createSvgElement('pattern'),
        image = createSvgElement('image'),
        text = createSvgElement('text');
    // Add attributes to elements
    addAttributes(pattern, {
      'id' :,
      'patternUnits' : 'userSpaceOnUse',
      'width' : a.width,
      'height' : a.height
    addAttributes(image, {
      'width' : a.width,
      'height' : a.height
    image.setAttributeNS('', 'xlink:href', a.url);
    addAttributes(text, {
      'x' : 0,
      'y' : 80,
      'class' : a['class'],
      'style' : 'fill:url(#' + + ');'
    // Set text
    text.textContent = a.text;
    // Add elements to pattern
    // Add elements to SVG
    return svg;
   * Replace the element if background-clip
   * is not available.
  if (!hasBackgroundClip()) {
    var img = new Image();
    img.onload = function() {
      var svg = createSVG({
        'id' : a.patternID,
        'url' : a.patternURL,
        'class' : a['class'],
        'width' : this.width,
        'height' : this.height,
        'text' : el.textContent
      el.parentNode.replaceChild(svg, el);
    img.src = a.patternURL;

var element = document.querySelector('.headline'); 

 * Call the polyfill
 * patternID : the unique ID of the SVG pattern
 * patternURL : the URL to the background-image
 * class : the css-class applied to the SVG
  'patternID' : 'mypattern',
  'patternURL' : '',
  'class' : 'headline'