Pen Settings



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


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.


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.


                <div class="demo">
  <div class="demo__widget fancy-gradient">
    <h1>Highly Customizable Background Gradients!</h1>

  <form class="demo__form">
    <fieldset class="u-border-medium u-rounded">
      <label for="bg_color">Color:</label>
      <input type="color" id="bg_color" value="#006dca" />

    <div class="demo__form-spots">
      <fieldset class="u-border-medium u-rounded">
        <legend>Spot One</legend>
        <label for="spot1_color">Color:</label>
        <input type="color" id="spot1_color" value="#001a39" />
        <label for="spot1_w">Width:</label>
        <input type="range" id="spot1_w" value="75" min="1" />
        <label for="spot1_h">Height:</label>
        <input type="range" id="spot1_h" value="75" min="1" />
        <label for="spot1_x">X Position:</label>
        <input type="range" id="spot1_x" value="0" />
        <label for="spot1_y">Y Position:</label>
        <input type="range" id="spot1_y" value="0" />

      <fieldset class="u-border-medium u-rounded">
        <legend>Spot Two</legend>
        <label for="spot2_color">Color:</label>
        <input type="color" id="spot2_color" value="#9b70ff" />
        <label for="spot2_w">Width:</label>
        <input type="range" id="spot2_w" value="75" min="1" />
        <label for="spot2_h">Height:</label>
        <input type="range" id="spot2_h" value="75" min="1" />
        <label for="spot2_x">X Position:</label>
        <input type="range" id="spot2_x" value="100" />
        <label for="spot2_y">Y Position:</label>
        <input type="range" id="spot2_y" value="0" />

      <fieldset class="u-border-medium u-rounded">
        <legend>Spot Three</legend>
        <label for="spot3_color">Color:</label>
        <input type="color" id="spot3_color" value="#42ffc6" />
        <label for="spot3_w">Width:</label>
        <input type="range" id="spot3_w" value="75" min="1" />
        <label for="spot3_h">Height:</label>
        <input type="range" id="spot3_h" value="75" min="1" />
        <label for="spot3_x">X Position:</label>
        <input type="range" id="spot3_x" value="100" />
        <label for="spot3_y">Y Position:</label>
        <input type="range" id="spot3_y" value="100" />

      <fieldset class="u-border-medium u-rounded">
        <legend>Spot Four</legend>
        <label for="spot4_color">Color:</label>
        <input type="color" id="spot4_color" value="#ff3b8d" />
        <label for="spot4_w">Width:</label>
        <input type="range" id="spot4_w" value="75" min="1" />
        <label for="spot4_h">Height:</label>
        <input type="range" id="spot4_h" value="75" min="1" />
        <label for="spot4_x">X Position:</label>
        <input type="range" id="spot4_x" value="0" />
        <label for="spot4_y">Y Position:</label>
        <input type="range" id="spot4_y" value="100" />

    <p>Here are the custom properties you set!</p>
    <textarea class="c-input"></textarea>


                // NOTE: This pen includes Cloud Four's pattern library CSS, so feel free to use any utility classes from there

/// 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

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

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

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

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

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

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

/// Base Styles

.demo {
  max-width: 800px;
  margin: auto;

.demo__widget {
  aspect-ratio: 16/9;
  width: 100%;
  position: relative;

.demo__widget h1 {
  color: rgba(255, 255, 255, 0.8);
  font-family: ui-rounded, system-ui, sans-serif;
  font-size: clamp(24px, 8vw, 70px);
  text-align: center;
  margin: 0;
  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);

.demo__form {
  margin: 1em;

.demo__form legend {
  font-weight: 600;

.demo__form fieldset {
  align-items: center;
  display: grid;
  gap: 0.33em 1em;
  grid-template-columns: minmax(0, auto) minmax(0, 1fr);

.demo__form input[type="color"] {
  width: 100%;

.demo__form textarea {
  font-family: monospace;
  width: 100%;
  height: 5em;

.demo__form-spots {
  display: grid;
  gap: 1em;
  margin-block: 1em;

  @media (min-width: 36em) {
    grid-template-columns: 1fr 1fr;


                const demoEl = document.querySelector(".demo__widget");
const outputEl = document.querySelector(".demo__form textarea");
const controlEls = document.querySelectorAll(".demo__form input");

const updateVar = (e) => {
  let value =;
  if ( === "range") value = `${}%`;`--gradient_${}`, value);
  outputEl.value = demoEl.getAttribute("style");

for (const control of controlEls) {
  control.addEventListener("input", updateVar);