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

              
                <div class="demo fancy-gradient fancy-gradient--rainbow">
  <h1 class="title">
    Royal Rainbow!
  </h1>
</div>
              
            
!

CSS

              
                ///
/// Highly Customizable Gradient Background
///
/// This background is created using a solid background color, and then four
/// radial gradient "spotlights". These spotlights are entirely defined with
/// custom properties, so they can be easily tweaked. For each spotlight,
/// you can change the color, width, height, and positioning.
///
/// Colors from https://reasonable.work/colors/
///

:root {
  // overall gradient background color
  --gradient_bg_color: #006dca; // blue

  // spot 1 - top left corner
  --gradient_spot1_color: #001a39; // dark blue
  --gradient_spot1_w: 75vw;
  --gradient_spot1_h: 75vh;
  --gradient_spot1_x: 0;
  --gradient_spot1_y: 0;

  // spot 2 - top right corner
  --gradient_spot2_color: #9b70ff; // violet
  --gradient_spot2_w: 75vw;
  --gradient_spot2_h: 75vh;
  --gradient_spot2_x: 100%;
  --gradient_spot2_y: 0;

  // spot 3 - bottom right corner
  --gradient_spot3_color: #42ffc6; // aquamarine
  --gradient_spot3_w: 75vw;
  --gradient_spot3_h: 75vh;
  --gradient_spot3_x: 100%;
  --gradient_spot3_y: 100%;

  // spot 4 - bottom left corner
  --gradient_spot4_color: #ff3b8d; // rose
  --gradient_spot4_w: 75vw;
  --gradient_spot4_h: 75vh;
  --gradient_spot4_x: 0;
  --gradient_spot4_y: 100%;
}

.fancy-gradient {
  background-color: var(--gradient_bg_color);
  background-image: radial-gradient(
      var(--gradient_spot1_w) var(--gradient_spot1_h) at left
        var(--gradient_spot1_x) top var(--gradient_spot1_y),
      var(--gradient_spot1_color),
      transparent
    ),
    radial-gradient(
      var(--gradient_spot2_w) var(--gradient_spot2_h) at left
        var(--gradient_spot2_x) top var(--gradient_spot2_y),
      var(--gradient_spot2_color),
      transparent
    ),
    radial-gradient(
      var(--gradient_spot3_w) var(--gradient_spot3_h) at left
        var(--gradient_spot3_x) top var(--gradient_spot3_y),
      var(--gradient_spot3_color),
      transparent
    ),
    radial-gradient(
      var(--gradient_spot4_w) var(--gradient_spot4_h) at left
        var(--gradient_spot4_x) top var(--gradient_spot4_y),
      var(--gradient_spot4_color),
      transparent
    );
}


///
/// Royal Rainbow!
/// The spots are arranged in a diagonal line at about the same angle
/// as the text to create a rainbow effect. Note that the spots are
/// a bit offset to the left because they're stacked, so the leftmost
/// spot covers more space than the rightmost.
///
.fancy-gradient--rainbow {
  --gradient_spot1_color: #db0072; /* rose */
  --gradient_spot1_w: 50vw;
  --gradient_spot1_h: 100vh;
  --gradient_spot1_x: -10%;
  --gradient_spot1_y: 80%;

  --gradient_spot2_color: #ffe53e; /* yellow */
  --gradient_spot2_w: 50vw;
  --gradient_spot2_h: 100vh;
  --gradient_spot2_x: 25%;
  --gradient_spot2_y: 60%;

  --gradient_spot3_color: #00ffe4; /* teal */
  --gradient_spot3_w: 50vw;
  --gradient_spot3_h: 100vh;
  --gradient_spot3_x: 55%;
  --gradient_spot3_y: 40%;

  --gradient_spot4_color: #d150ff; /* purple */
  --gradient_spot4_w: 50vw;
  --gradient_spot4_h: 100vh;
  --gradient_spot4_x: 90%;
  --gradient_spot4_y: 20%;
}

///
/// Base Styles
///

.demo {
  width: 100vw;
  height: 100vh;
  position: relative;
}

.title {
  color: rgba(255, 255, 255, 0.8);
  font-family: ui-rounded, system-ui, sans-serif;
  font-size: clamp(32px, 9vw, 200px);
  text-align: center;
  position: absolute;
  left: 0;
  right: 0;
  top: 50%;
  transform: translateY(-50%) skew(0deg, -10deg);
  text-shadow: 0.025em 0.025em 0.025em rgba(0,0,0,0.1);
}

* {
  margin: 0;
}

              
            
!

JS

              
                
              
            
!
999px

Console