Pen Settings

HTML

CSS

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

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

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.

HTML

              
                <p>Rainbow Road is a recurring course found in the Mario Kart series, where it closes the Special Cup and the Grand Prix seasons overall. All the versions of the track share common elements : they are all suspended in space or sky, and have a very colorful track layout, hence the name, and powerful themed music. An uplifting-themed music has remained with Rainbow Road throughout the series. The roads often have limited railing, making the course extremely hard. They are sometimes the longest in the their games, notably Mario Kart 64's version, with a length of 2 kilometers and 2 minutes laptimes. An uplifting-themed music has remained with Rainbow Road throughout the series. The roads often have limited railing, making the course extremely hard. They are sometimes the longest in the their games, notably Mario Kart 64's version, with a length of 2 kilometers and 2 minutes laptimes. </p>
<h1 class="rainbow">rainbow road</h1>
<p>Rainbow Road is a recurring course found in the Mario Kart series, where it closes the Special Cup and the Grand Prix seasons overall. All the versions of the track share common elements : they are all suspended in space or sky, and have a very colorful track layout, hence the name, and powerful themed music. An uplifting-themed music has remained with Rainbow Road throughout the series. The roads often have limited railing, making the course extremely hard. They are sometimes the longest in the their games, notably Mario Kart 64's version, with a length of 2 kilometers and 2 minutes laptimes.</p>
<h1 class="rainbow">rainbow</h1>
<p>Rainbow Road is a recurring course found in the Mario Kart series, where it closes the Special Cup and the Grand Prix seasons overall. All the versions of the track share common elements : they are all suspended in space or sky, and have a very colorful track layout, hence the name, and powerful themed music. An uplifting-themed music has remained with Rainbow Road throughout the series. The roads often have limited railing, making the course extremely hard. They are sometimes the longest in the their games, notably Mario Kart 64's version, with a length of 2 kilometers and 2 minutes laptimes.</p>
<h1 class="rainbow">road</h1>
              
            
!

CSS

              
                html {
  font-size: 24px;
  padding-top: 6rem;
  overflow-x: hidden;
}

body {
  display: grid;
  background-color: #000;
}

p {
  width: 50vw;
  font-family: Montserrat, "Adobe NotDef";
  font-weight: 400;
  font-size: 1rem;
  line-height: 1.5;
  color: #fff;
  margin: auto;
}

h1 {
  margin-left: -100%;
  margin-right: -100%;
  text-align: center;
  font-family: Montserrat, "Adobe NotDef";
  font-weight: 900;
  font-size: 10rem;
  letter-spacing: 0.3rem;
  color: #000;
}

.rainbow {
  position: relative;
  opacity: 0.5;
  transition: 2s all ease;
  text-shadow: 0 0.1rem 0.2rem Red, 0 -0.1rem 0.2rem Red, 0 0.2rem Black,
    0 -0.2rem Black, 0 0.3rem 0.2rem Orange, 0 -0.3rem 0.2rem Orange,
    0 0.4rem Black, 0 -0.4rem Black, 0 0.5rem 0.2rem Yellow,
    0 -0.5rem 0.2rem Yellow, 0 0.6rem Black, 0 -0.6rem Black,
    0 0.7rem 0.2rem Green, 0 -0.7rem 0.2rem Green, 0 0.8rem Black,
    0 -0.8rem Black, 0 0.9rem 0.2rem Blue, 0 -0.9rem 0.2rem Blue, 0 1rem Black,
    0 -1rem Black, 0 1.1rem 0.2rem Indigo, 0 -1.1rem 0.2rem Indigo;
}

.rainbow.active {
  opacity: 1;
  text-shadow: 0 0.1rem 0.2rem Red, 0 -0.1rem 0.2rem Red, 0 1rem Black,
    0 -1rem Black, 0 1.1rem 0.2rem Orange, 0 -1.1rem 0.2rem Orange, 0 2rem Black,
    0 -2rem Black, 0 2.1rem 0.2rem Yellow, 0 -2.1rem 0.2rem Yellow, 0 3rem Black,
    0 -3rem Black, 0 3.1rem 0.2rem Green, 0 -3.1rem 0.2rem Green, 0 4rem Black,
    0 -4rem Black, 0 4.1rem 0.2rem Blue, 0 -4.1rem 0.2rem Blue, 0 5rem Black,
    0 -5rem Black, 0 5.1rem 0.2rem Indigo, 0 -5.1rem 0.2rem Indigo;
}

              
            
!

JS

              
                function rainbow() {
  var reveals = document.querySelectorAll(".rainbow");

  for (var i = 0; i < reveals.length; i++) {
    var windowHeight = window.innerHeight;
    var elementTop = reveals[i].getBoundingClientRect().top;
    var elementBottom = reveals[i].getBoundingClientRect().bottom;
    var elementVisible = 20;

    if (elementTop < windowHeight - elementVisible) {
      reveals[i].classList.add("active");
    } else {
      reveals[i].classList.remove("active");
    }
  }
}

window.addEventListener("scroll", rainbow);

              
            
!
999px

Console