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>Interesting CSS Color Contrast Technique</h1>

<form hidden>  
  <ground-control set-prop="--cutoff">
    <label for="cutoff">Cutoff</label>
    <input id="cutoff" type="range" min="50" max="150" value="130">
    <output for="cutoff"></output>

  <ground-control set-prop="--h">
    <label for="h">Hue</label>
    <input id="h" type="range" min="0" max="360" value="0">
    <output for="h"></output>

  <ground-control set-prop="--s">
    <label for="s">Saturation</label>
    <input id="s" type="range" min="0" max="100" value="50">
    <output for="s"></output>

  <ground-control set-prop="--l">
    <label for="l">Lightness</label>
    <input id="l" type="range" min="0" max="100" value="50">
    <output for="l"></output>

    A technique by <a href="">miunau</a>.
    The text and background have to be
    on separate elements 
    (in this case the root and <code>h1</code>).
    I used HSL sliders (instead of the more consistent okLCH)
    because I wanted to see it react to 
    inconsistent brightness across different hues.


                html {
  background: var(--bgColor);

h1 {
  color: var(--bgColor);
    brightness(calc(var(--cutoff) / 100))
  maybe these help 
  with crunchy edges 
  at the transition? 
  I'm not convinced… */
  -moz-osx-font-smoothing: grayscale;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
  mix-blend-mode: luminosity;

@layer setup {
  html {
    --bgColor: hsl(
      calc(var(--h) * 1deg)
      calc(var(--s) * 1%) 
      calc(var(--l) * 1%) 
  body {
    display: grid;
    place-content: center;
    font-size: clamp(1.25rem, 1.163rem + 0.4348vi, 1.5rem);
    margin: 0;
    padding: 1em;

  form, footer {
    background: Canvas;
    border-radius: 6px;
    color-scheme: dark light;
    color: CanvasText;  
    max-width: 70ch;
    opacity: 0.95;
    padding: 1em;

  form {
    display: grid;
    gap: 0.5lh;

  footer {
    margin-block: 1em;

  ground-control {
    display: grid;
    gap: 0.25lh 1em;
    grid-template: 'l l' auto 'r o' auto / 1fr 4ch;

  label {
    grid-area: l;
  output {
    text-align: right;
    font-family: monospace;

  hr {
    margin-inline: 0;

  [hidden] {
    display: none !important;



// using 'ground-control' custom element
// from