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.


                <svg xmlns="" viewBox="0 0 200 200">
    <!-- x1、y1はグラデーションの始点、x2、y2はグラデーションの終点 -->
    <linearGradient id="js-gradient" x1="0%" y1="0%" x2="100%" y2="100%" gradientUnits="userSpaceOnUse">
      <!-- 始点は赤、終点は青に設定 -->
      <stop id="js-gradient__stop-1" offset="0%" stop-color="red"/>
      <stop id="js-gradient__stop-2" offset="100%" stop-color="blue"/>
  <!-- g要素、fill属性の中に、linearGradient要素のidを記述することで、グラデーションが適応されます。 -->
  <g fill="url(#js-gradient)">
    <rect width="200px" height="200px"></rect>


body {
  height: 2000vh;

svg {
  position: fixed;
  left: 50%;
  top: 50%;
  transform: translate(-50%, -50%);
  width: 200px;
  height: 200px;


                var $gradientStop1 = document.querySelector('#js-gradient__stop-1');
var $gradientStop2 = document.querySelector('#js-gradient__stop-2');

window.addEventListener('scroll', function() {
  var scrollTop = window.pageYOffset;
  var val = scrollTop / 20;
  var hue1 = (val) % 360;
  var hue2 = (val + 50) % 360;
  TweenMax.set($gradientStop1, {
    stopColor: 'hsl('+hue1+', 100%, 50%)'

  TweenMax.set($gradientStop2, {
    stopColor: 'hsl('+hue2+', 100%, 50%)'