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

              
                <section>
  <h1>CSS Color-Mix() - Art Class Demo</h1>

  <p>Using the CSS color-mix() function, we're able to mix primary and secondary colors to form a linear color 'wheel'. This feature is currently (15.4.2022) only available behind flags in Firefox and <a href="https://developer.apple.com/safari/technology-preview/">Safari Technology Preview</a>.</p>

  <section class="wheel">
    <div class="primary one"></div>
    <div class="tertiary one"></div>
    <div class="secondary one"></div>
    <div class="tertiary two"></div>
    <div class="primary two"></div>
    <div class="tertiary three"></div>
    <div class="secondary two"></div>
    <div class="tertiary four"></div>
    <div class="primary three"></div>
    <div class="tertiary five"></div>
    <div class="secondary three"></div>
    <div class="tertiary six"></div>
    <div class="primary one"></div>
  </section>

</section>

<div class="not-supported">The color-mix() feature is not supported in your browser.</div>
              
            
!

CSS

              
                .wheel {
  --primary-1: #ff0;
  --primary-2: #f00;
  --primary-3: #00f;
  --secondary-1: color-mix(in hwb, var(--primary-1) 50%, var(--primary-2));
  --secondary-2: color-mix(in hwb, var(--primary-2) 50%, var(--primary-3));
  --secondary-3: color-mix(in hwb, var(--primary-3) 50%, var(--primary-1));
  --tertiary-1: color-mix(in hwb, var(--primary-1) 50%, var(--secondary-1));
  --tertiary-2: color-mix(in hwb, var(--secondary-1) 50%, var(--primary-2));
  --tertiary-3: color-mix(in hwb, var(--primary-2) 50%, var(--secondary-2));
  --tertiary-4: color-mix(in hwb, var(--secondary-2) 50%, var(--primary-3));
  --tertiary-5: color-mix(in hwb, var(--primary-3) 50%, var(--secondary-3));
  --tertiary-6: color-mix(in hwb, var(--secondary-3) 50%, var(--primary-1));

  align-items: center;
  display: flex;
  justify-content: space-between;
  pading-block-end: 1rem;

  div {
    border-radius: 4px;
    transition: all 0.1s ease;

    &:hover {
      transform: scaleY(1.1);
      transform-origin: center;
    }
  }

  .primary {
    block-size: 150px;
    inline-size: 25px;

    &.one {
      background: var(--primary-1);
    }
    &.two {
      background: var(--primary-2);
    }
    &.three {
      background: var(--primary-3);
    }
  }

  .secondary {
    block-size: 125px;
    inline-size: 20px;

    &.one {
      background: var(--secondary-1);
    }
    &.two {
      background: var(--secondary-2);
    }
    &.three {
      background: var(--secondary-3);
    }
  }
  .tertiary {
    block-size: 100px;
    inline-size: 15px;

    &.one {
      background: var(--tertiary-1);
    }
    &.two {
      background: var(--tertiary-2);
    }
    &.three {
      background: var(--tertiary-3);
    }
    &.four {
      background: var(--tertiary-4);
    }
    &.five {
      background: var(--tertiary-5);
    }
    &.six {
      background: var(--tertiary-6);
    }
  }
}

/* GLOBAL */
:root {
  --body-bg: #f0efeb;
  --color-text: #000;
  --color-link: #011627;

  --color-primary: #fcca46;
  --color-secondary: #e71d36;
  --color-accent: #00afb9;

  --scrollbar-bg: #222;
}

body::-webkit-scrollbar {
  width: 10px;
}
body {
  scrollbar-width: thin;
  scrollbar-color: var(--color-primary) var(--scrollbar-bg);
}
body::-webkit-scrollbar-track {
  background: var(--scrollbar-bg);
}
body::-webkit-scrollbar-thumb {
  background-color: var(--color-primary);
  border-radius: 6px;
  border: 3px solid var(--scrollbar-bg);
}

html,
body {
  color: var(--color-text);
  font-family: "Barlow", sans-serif;
  font-size: 100%;
  letter-spacing: 0.25px;
  line-height: 1.75;
  margin: 0;
  padding: 0;
}

body {
  background: var(--body-bg);
  background: linear-gradient(
    50deg,
    var(--color-secondary) 0%,
    var(--color-secondary) 5%,
    var(--color-primary) 5%,
    var(--color-primary) 12%,
    var(--body-bg) 12%,
    var(--body-bg) 13%,
    var(--color-accent) 13%,
    var(--color-accent) 14%,
    var(--body-bg) 14%
  );
  block-size: 100%;
  display: grid;
  min-block-size: 100vh;
  place-items: center;
}

a {
  color: var(--color-link);
  text-decoration: underline 1px dashed;
  text-underline-offset: min(5px, 1em);

  &:hover {
    color: color-mix(in srgb, var(--color-link) 90%, var(--color-secondary));
  }

  &:focus {
    outline: 1px solid currentColor;
    outline-offset: 3px;
  }
}

h1,
h2 {
  font-family: "Hubballi", cursive;
  line-height: 1.25;
}

section {
  inline-size: min(750px, 60vw);
}

.not-supported {
  background: #600;
  border-radius: 8px;
  color: #fff;
  font-size: 0.9rem;
  padding: 0.5rem 1rem;
  position: fixed;
  inset-block-end: 1rem;
  inset-inline-start: 1rem;

  @supports (background: color-mix(in srgb, #34c9eb 10%, white)) {
    display: none;
  }
}

              
            
!

JS

              
                
              
            
!
999px

Console