Pen Settings



CSS Base

Vendor Prefixing

Add External Stylesheets/Pens

Any URL's 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 it's URL and the proper URL extention.

+ 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 style="background-image: url(;" class="text-clip something">AIAI</h1>

<h2 style="background-image: url(;" class="text-clip">30</h2>



                body {
  background: #112634;
.text-clip {
  display: inline;
  font-weight: 700;
  padding: 0;
  margin: 0;
  line-height: 1;
  height: 350px;
  width: auto;
  line-height: 1;
  background-color: transparent;
  background-repeat: no-repeat; 
  -webkit-text-fill-color: transparent; 
  -webkit-background-clip: text; 



                function runClip() { 
    var $svgEle = $(this);
    var hgt = $svgEle.height(); //height of text element
    var wdth = $svgEle.width(); //width of text element
    var bgImgH; //will be height of background-image
    var bgImgW; //will be width of background-image
    var pattW; //calculated width of pattern image
    var pattH; //calculated height of pattern image
    var value = $svgEle.html(); //gets text to push into svg
    var pattID = 'patternIMG' + i; //sets id for pattern using index to make it unique
    var classes = $svgEle.attr('class'); //grabs all classes of text element
    var aiPattURL = $svgEle.css('background-image').slice(4, -1).replace(/"/g, ""); //gets background-image url 

    var getImage = function(url) {
      var dfd = new $.Deferred();

      if (url) {
          var image = new Image();
          image.onload = dfd.resolve;
          image.onerror = dfd.reject;
          image.src = url;
      } else {

      return dfd.then(function() {
          return { width: this.width, height: this.height };

    .then(function(size) {
      bgImgW = size.width;
      bgImgH = size.height;
      //Checks aspect ratio of text vs background-image then sets pattern image size vars.
      if( hgt/wdth > bgImgH/bgImgW ){
        pattH = hgt;
        pattW = hgt * bgImgW / bgImgH;
      } else {
        pattW = wdth;
        pattH = wdth * bgImgH / bgImgW;
      //Prints svg where text element used to be.
      $svgEle.replaceWith('<svg viewBox="0 0 ' + wdth + ' ' + hgt + '" height="'+ hgt +'" width="' + wdth + '"><pattern patternUnits="userSpaceOnUse" height="'+ pattH +'" width="' + pattW + '" id="'+ pattID +'" ><image  x="0" y="0" height="'+ pattH +'" width="' + pattW + '" xlink:href="' + aiPattURL + '"></image></pattern><text x="0" y="77%" class="'+ classes +'" fill="url(#' + pattID + ')" >' + value + '</text></svg>')
    .fail(function() {
      console.log('CSS background-image failed to load, sorry...');
try {
  // Checks if -webkit-background-clip: text is supported.
  if ( !CSS.supports("-webkit-background-clip", "text") ){
} catch(e){
  // Callback catch for older browsers that don't understand CSS.suppports().

//uncomment to test:
// runClip()