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

              
                <div class="page">
  <div class="wrapper dark">
    <p>暗い背景色( mix-blend-mode: multiply;)</p>
    <div class="gradation-text">
      <span class="splitting" style="--i:0">テ</span><span class="splitting" style="--i: 1;">キ</span><span class="splitting" style="--i:2;">ス</span><span class="splitting" style="--i:3;">ト</span><span class="splitting" style="--i:4;">の</span><span class="splitting" style="--i:5;">テ</span><span class="splitting" style="--i:6;">ス</span><span class="splitting" style="--i:7;">ト</span>
    </div>
  </div>

  <div class="wrapper light">
    <p>明るい背景色( mix-blend-mode: screen;)</p>
    <div class="gradation-text">
      <span class="splitting" style="--i:0">テ</span><span class="splitting" style="--i: 1;">キ</span><span class="splitting" style="--i:2;">ス</span><span class="splitting" style="--i:3;">ト</span><span class="splitting" style="--i:4;">の</span><span class="splitting" style="--i:5;">テ</span><span class="splitting" style="--i:6;">ス</span><span class="splitting" style="--i:7;">ト</span>
    </div>
  </div>
</div>
              
            
!

CSS

              
                .dark .gradation-text {
  color: #fff;
  background: #000;
}

.light .gradation-text {
  color: #000;
  background: #fff;
}

.gradation-text::before {
  content: "";
  position: absolute;
  inset: 0;
  /*  文字色  */
  background-image: linear-gradient(45deg, #276acb, #00c5ff, #0ffe37);
  /* すでにsplittingより前面にあるが、アニメーションがうまく働かないため。afterの場合不要  */
  z-index: 1;
  /*テキスト選択やクリックができるように */
  pointer-events: none;
}

.dark .gradation-text::before {
  /*   グラデーションテキスト用(背景色が暗い場合) */
  mix-blend-mode: multiply;
}

.light .gradation-text::before {
  /*   グラデーションテキスト用(背景色が明るい場合)*/
  mix-blend-mode: screen;
}

.splitting {
  display: inline-block;
  animation-name: show;
  animation-duration: 1s;
  animation-timing-function: ease-in-out;
  animation-fill-mode: backwards;
  animation-delay: calc(0.2s * var(--i));
}

@keyframes show {
  0% {
    rotate: 30deg;
    translate: -30px -30px;
    opacity: 0;
  }
  100% {
    rotate: 0deg;
    translate: 0 0px;
  }
}


/*=======================================
装飾用
========================================*/
*,
*::before,
*::after {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

.page {
  display: grid;
  min-height: 100svh;
  grid-template-rows: 1fr 1fr;
}

.wrapper {
  display: grid;
  place-items: center;
  grid-template-rows: auto 1fr;
  text-align: center;
}

.dark {
  background: #222;
}

.light {
  background: #f1f1f1;
}

p {
  font-size: 24px;
  padding-top: 40px;
}

.dark p {
  color: #fff;
}

.gradation-text {
  position: relative;
  display: inline-block;
  font-size: 40px;
  padding: 40px;
}

.dark .gradation-text {
  /*  darkの背景色(#222)と同化させる  */
  mix-blend-mode: lighten;
}

.light .gradation-text {
  /*  lightの背景色(#f1f1f1)と同化させる  */
  mix-blend-mode: multiply;
}

              
            
!

JS

              
                
              
            
!
999px

Console