Pen Settings

HTML

CSS

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

JavaScript

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

Packages

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.

Behavior

Auto Save

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.

HTML

              
                <article>
  <h1>Animated Gradient Text</h1>
  <p>@property + linear-gradient() + background-clip + text-fill-color</p>
</article>
              
            
!

CSS

              
                /* 
  these type the CSS variable as color
  unlocking the ability for the browser 
  to animate just that portion
*/
@property --@color-1 {
  syntax: "<color>";
  inherits: false;
  initial-value: hsl(98 100% 62%);
}

@property --@color-2 {
  syntax: "<color>";
  inherits: false;
  initial-value: hsl(204 100% 59%);
}

/* keyframes that change the color variable */
@keyframes gradient-change {
  to {
    --@color-1: hsl(210 100% 59%);
    --@color-2: hsl(310 100% 59%);
  }
}

article {
  /* apply variable changes over time */
  animation: gradient-change 2s linear infinite alternate;
  
  background: linear-gradient(
    /* 
      in oklch produces more vibrant gradient results 
      learn more https://developer.chrome.com/docs/css-ui/access-colors-spaces#color_interpolation
    */
    to right in oklch, 
    /* use the variables in a gradient (or wherever!) */
    var(--@color-1), 
    var(--@color-2)
  );
  
  /* old browser support */
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  
  /* modern browser version */
  background-clip: text;
  color: transparent;
}












@layer demo.support {
  h1 {
    font-size: 10vmin;
    line-height: 1.1;
  }

  body {
    background: hsl(204 100% 5%);

    min-block-size: 100%;
    box-sizing: border-box;
    display: grid;
    place-content: center;

    font-family: system-ui, sans-serif;
    font-size: min(200%, 4vmin);

    padding: 5vmin;
  }

  h1, p, body {
    margin: 0;
    text-wrap: balance;
  }

  h1 {
    line-height: 1.25cap;
  }

  p {
    font-family: "Dank Mono", ui-monospace, monospace;
  }

  html {
    block-size: 100%;
  }

  article {
    display: grid;
    gap: 1lh;
    text-align: center;
  }
}
              
            
!

JS

              
                
              
            
!
999px

Console