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.


  <h1>CSS Color-Mix() - Opacities Demo</h1>

  <p>Using the CSS color-mix() function, we can experiment with the results of different base and blend color opacities. This feature is currently (15.4.2022) only available behind flags in Firefox and <a href="">Safari Technology Preview</a>.</p>

  <section class="container">
    <div id="base">50%</div>
    <div id="blend">50%</div>
    <div id="result-container">
      <div id="result"></div>

    <label>Base Color Opacity <input type="range" min="0" max="100" step="1" id="base-percent-slider" value="50" /></label>

    <label>Blend Color Opacity <input type="range" min="0" max="100" step="1" id="blend-percent-slider" value="50" /></label>

  <p>🚀 Bonus: We're using CSS color-contrast() to display the percentage values.</p>

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


                body {
  --base-opacity: 50%;
  --blend-opacity: 50%;
  --base-color: rgba(255, 0, 0, var(--base-opacity));
  --blend-color: rgba(0, 0, 255, var(--blend-opacity));

.container {
  display: grid;
  grid-gap: 1rem;
  grid-template-columns: repeat(3, minmax(100px, max-content));
  justify-content: space-between;
  place-items: center;

  div {
    block-size: 100px;
    display: grid;
    inline-size: 100px;
    place-items: center;

  #base {
    background: var(--base-color);
    color: color-contrast(var(--base-color) vs black, white to AA);

  #blend {
    background: var(--blend-color);
    color: color-contrast(var(--blend-color) vs black, white to AA);

  #result-container {
    background: url("")
    background-size: contain;

  #result {
    --result-color: color-mix(
      in lch,
      var(--base-color) 50%,
    background: var(--result-color);

/* GLOBAL */
:root {
  --body-bg: #e2ece9;
  --color-text: #000;
  --color-link: #006d77;

  --color-primary: #cddafd;
  --color-secondary: #fad2e1;
  --color-accent: #006d77;

  --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);

body {
  accent-color: var(--color-accent);
  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(
    var(--body-bg) 0%,
    var(--body-bg) 3%,
    var(--color-accent) 3%,
    var(--color-accent) 4%,
    var(--body-bg) 4%,
    var(--body-bg) 91%,
    var(--color-secondary) 91%,
    var(--color-secondary) 95%,
    var(--color-primary) 95%,
    var(--color-primary) 100%
  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;

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;

label {
  display: grid;
  font-weight: 700;
  grid-gap: 0.5rem;
  place-items: center;



  .addEventListener("input", (e) => {"--base-opacity", + "%");
    document.querySelector("#base").innerHTML = + "%";

  .addEventListener("input", (e) => {"--blend-opacity", + "%");
    document.querySelector("#blend").innerHTML = + "%";