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. If you link to another Pen, it will include the CSS from that Pen. If the preprocessor matches, it will attempt to combine them before processing.

+ 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="neons">
  <button contenteditable>Neon Love</button>
</div>

<div class="panel">

  <div class="controls">
    <header>
      <h3>Controls</h3>
    </header>
    <div>
      <label for="hue">Hue</label>
      <input type="range" min="0" max="360" value="180" step="1" id="hue" oninput="this.nextElementSibling.value = this.value">
      <output>0</output>
    </div>

    <div>
      <label for="saturation">Saturation</label>
      <input type="range" min="0" max="100" value="50" step="1" id="saturation" oninput="this.nextElementSibling.value = this.value + '%'">
      <output>0%</output>
    </div>

    <div>
      <label for="light">Light</label>
      <input type="range" min="0" max="100" value="50" step="1" id="light" oninput="this.nextElementSibling.value = this.value + '%'">
      <output>0%</output>
    </div>
    
    <div style="display:none" id="grad-section">
      <label for="gradient-light">Gradient Light</label>
      <input type="range" min="0" max="100" value="50" step="1" id="gradient-light" oninput="this.nextElementSibling.value = this.value + '%'">
      <output>0%</output>
    </div>
    
    <div>
      <label for="gradient">gradient</label>
      <input type="checkbox" id="gradient">
    </div>
    
    <div>
      <label for="animate">animate</label>
      <input type="checkbox" id="animate">
    </div>
  </div>

  <div class="result">
    <pre>
    <code>
appearance: none;
border: 0px none rgb(51, 153, 153);
-webkit-font-smoothing: antialiased;
border-radius: 4px;
display: flex;
padding: 8px 16px;
justify-content: center;
cursor: pointer;
font-weight: 700;
font-size: 18px;
letter-spacing: 1.5px;
text-align: center;
text-transform: uppercase;
font-family: Helvetica;

/* Color */
color: rgb(51, 153, 153);
text-shadow: rgba(0, 0, 0, 0.3) 0px -1px 0px, rgba(255, 255, 255, 0.15) 0px 1px 0px;

/* Background */
background: rgba(0, 0, 0, 0) linear-gradient(rgb(64, 191, 191), rgb(57, 172, 172)) repeat scroll 0% 0% / auto padding-box border-box;

box-shadow: rgba(68, 193, 193, 0.3) 0px 5px 10px 0px, rgba(68, 193, 193, 0.25) 0px 10px 40px 0px, rgba(68, 193, 193, 0.25) 0px 15px 80px 0px, rgba(0, 0, 0, 0.05) 0px 2px 1px 0px, rgba(0, 0, 0, 0.05) 0px 4px 2px 0px, rgba(0, 0, 0, 0.05) 0px 8px 4px 0px, rgba(0, 0, 0, 0.05) 0px 16px 8px 0px, rgba(0, 0, 0, 0.05) 0px 32px 16px 0px, rgba(0, 0, 0, 0.6) 0px -1px 0px 0px inset, rgba(255, 255, 255, 0.3) 0px 1px 0px 0px inset;

transition: box-shadow 0.2s ease 0s, background 0.2s ease 0s;
will-change: box-shadow, background;
    </code>
  </pre>
  </div>
</div>
              
            
!

CSS

              
                :root {
  --raven: #2c343b;
  --lilia: #f1f3f4;
  --base-font-size: 18px;
  --base-font-weight: 300;
  
  /* Theme */
  --hue: 180;
  --saturation: 50%;
  --light: 50%;
  --theme-hsl: var(--hue), var(--saturation), var(--light);
  
  /* uncomment if you want a gradient 
    
  --gradient-light: 50%;
  */
}

html {
  background: var(--raven);
  color: var(--lilia);
  padding: 1em;
  font-family: arial;
}

.neons {
  padding: 1em;
  min-height: 180px;
}

/* Panel */
.panel {
  display: flex;
  justify-content: space-between;
}

/* Controls */
.controls,
.result {
  background: var(--lilia);
  color: var(--raven);
  padding: 1em;
  width: max-content;
  border-radius: 4px;
}

.controls label {
  display: block;
}

/* Result ( code ) */

.result {
  padding: 1em;
  color: white;
  text-shadow: 0 2px 10px hsl(var(--theme-hsl));
  overflow: hidden;
  margin-left: 16px
}
.result pre {
  padding: 0 1em;
  margin: 0;
  background: var(--raven);
  overflow: auto;
}
.result code {
  padding: 1em;
  margin: 0;
}

input {
  /* Canary: 
   * Enable the "Experimental Web Platform Features" flag in about:flags
   */
  accent-color: hsl(var(--theme-hsl))
}

.neons {
  display: flex;
  align-items: center;
  justify-content: center;
}

.neons button {
  appearance: none;
  border: 0;
  -webkit-font-smoothing: antialiased;
  border-radius: 4px;
  display: flex;
  padding: 8px 16px;
  justify-content: center;
  cursor: pointer;
  font-weight: 700;
  font-size: var(--base-font-size);
  letter-spacing: 1.5px;
  text-align: center;
  text-transform: uppercase;
  font-family: Helvetica;
  
  /* Color */
  color: hsl(var(--hue), var(--saturation), 40%);
  text-shadow: 0 -1px  0 rgb(0 0 0 / 30%),
    0 1px  0 rgb(255 255 255 / 15%);
  
  /* Background */
  background: linear-gradient(
    hsl(var(--theme-hsl)), 
    hsl(var(--hue), var(--saturation), var(--gradient-light, var(--light))));
  
  box-shadow: 
    /* Color */
    0 5px 10px  hsla(var(--theme-hsl), 0.30),
    0 10px 40px hsla(var(--theme-hsl), 0.25),
    0 15px 80px hsla(var(--theme-hsl), 0.25),
    
    /* Shadow */ 
    0 2px 1px rgba(0, 0, 0, 0.05), 
    0 4px 2px rgba(0, 0, 0, 0.05),
    0 8px 4px rgba(0, 0, 0, 0.05), 
    0 16px 8px rgba(0, 0, 0, 0.05),
    0 32px 16px rgba(0, 0, 0, 0.05), 
    /* Borders */
    inset 0 -1px  0 rgb(0 0 0 / 60%),
    inset 0 1px  0 rgb(255 255 255 / 30%);
    
  transition: box-shadow 0.2s ease, background 0.2s ease;
  will-change: box-shadow, background;
}

              
            
!

JS

              
                const outputCSS = () => {
  const button = document.querySelector('.neons button:first-of-type');
    const buttonCss = getComputedStyle(button);
        
    document.querySelector('.result pre code').innerHTML = `
appearance: ${buttonCss.appearance};
border: ${buttonCss.border};
-webkit-font-smoothing: ${buttonCss.webkitFontSmoothing};
border-radius: ${buttonCss.borderRadius};
display: ${buttonCss.display};
padding: ${buttonCss.padding};
justify-content: ${buttonCss.justifyContent};
cursor: ${buttonCss.cursor};
font-weight: ${buttonCss.fontWeight};
font-size: ${buttonCss.fontSize};
letter-spacing: ${buttonCss.letterSpacing};
text-align: ${buttonCss.textAlign};
text-transform: ${buttonCss.textTransform};
font-family: ${buttonCss.fontFamily};

/* Color */
color: ${buttonCss.color};
text-shadow: ${buttonCss.textShadow};

/* Background */
background: ${buttonCss.background};

box-shadow: ${buttonCss.boxShadow};

transition: ${buttonCss.transition};
will-change: ${buttonCss.willChange};
    `
}

const controls = ["hue", "saturation", "light", "gradient-light"];

controls.map((control) => {
  document.querySelector(`input#${control}`).addEventListener("input", (e) => {
    if (control !== "hue") {
      document.documentElement.style.setProperty(
        `--${control}`,
        `${e.target.value}%`
      );
    } else {
      document.documentElement.style.setProperty(
        `--${control}`,
        e.target.value
      );
    }
    
    outputCSS();
  });
});


document.getElementById('gradient').addEventListener('click', e => {
  if (e.target.checked) {
    document.getElementById('grad-section').style.display="block"
  } else {
    document.getElementById('grad-section').style.display="none";
    document.documentElement.style.removeProperty('--gradient-light')
  }
});
/* 
- them: Nooooo don't do this you can't do this it's not allowed >:'( 
- me: lol, background-color go brr brr :D :p 
*/

document.getElementById('animate').addEventListener('click', e => {
  if (e.target.checked) {
    var i = 0;
    setInterval(() => {
      if (i <= 359) {
        i++;
        document.documentElement.style.setProperty(
          `--hue`,
          i
        );
        document.getElementById('hue').value=i;
        document.getElementById('hue').nextElementSibling.value=i;
        outputCSS();
      } else {
        i = 0
      }
    }, 100)
  }
})
              
            
!
999px

Console