Pen Settings

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

You're using npm packages, so we've auto-selected Babel for you here, which we require to process imports and make it all work. If you need to use a different JavaScript preprocessor, remove the packages in the npm tab.

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

Use npm Packages

We can make npm packages available for you to use in your JavaScript. We use webpack to prepare them and make them available to import. We'll also process your JavaScript with Babel.

⚠️ This feature can only be used by logged in users.

Code Indentation


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.

HTML Settings

Here you can Sed posuere consectetur est at lobortis. Donec ullamcorper nulla non metus auctor fringilla. Maecenas sed diam eget risus varius blandit sit amet non magna. Donec id elit non mi porta gravida at eget metus. Praesent commodo cursus magna, vel scelerisque nisl consectetur et.

  //- The colors
  - const colors = ['transparent', '#f22613', '#e74c3c', '#f62459', '#663399', '#9a12b3', '#bf55ec', '#19b5fe', '#1e8bc3', '#1f3a93', '#89c4f4', '#03c9a9', '#26c281', '#16a085', '#2eec71', '#f2784b', '#f89406', '#f9bf3b']
    - for (let i = 0; i < colors.length; i++)
      label.lighten(title=`Lighten w/ ${colors[i]}`, class=`${colors[i] === 'transparent' ? 'clear' : ''}`, for=`lighten--${i}`, style=`--bg: ${colors[i]}; --angle: ${(360 / colors.length) * i}`)
      input(id=`lighten--${i}`, type='radio', value=`${colors[i]}`, name='lighten', style=`--angle: ${(360 / colors.length) * i}`)
    - for (let i = 0; i < colors.length; i++)
      label.darken(title=`Darken w/ ${colors[i]}`, class=`${colors[i] === 'transparent' ? 'clear' : ''}`, for=`darken--${i}`, style=`--bg: ${colors[i]}; --angle: ${(360 / colors.length) * i}`)
      input(id=`darken--${i}`, type='radio', value=`${colors[i]}`, name='darken', style=`--angle: ${(360 / colors.length) * i}`)
  svg.indicator(preserveAspectRatio='xMinYMin', viewBox="0 0 24 24")
  box-sizing border-box

  background-color #111
  min-height 100vh
  overflow hidden
  overflow-y scroll
  display flex
  align-items center
  justify-content center

$duration = .25s
$border = 4px

  background linear-gradient(45deg, #aaa, #111)
  width 100vw
  height 100vh
  min-height 550px
  position relative
  background url('https://source.unsplash.com/220x220?bear,cat'), linear-gradient(45deg, #111, #aaa)
  background-size cover
  border-radius 100%
  height 220px
  left 50%
  overflow hidden
  position absolute
  top 50%
  transform translate(-50%, -50%)
  width 220px

    bottom 0
    content ''
    left 0
    position absolute
    right 0
    top 0
    transition background $duration $duration

    background var(--lighten)
    mix-blend-mode lighten

    background var(--darken)
    mix-blend-mode darken

  height 40px
  left 50%
  position absolute
  top 50%
  transform translate(-50%, -260px)
  width 40px
    fill #fff

  display none

  position absolute
  top 50%
  left 50%
  transform rotate(calc(((var(--selectedRotation, 0) * -1) - 90) * 1deg))
  transition transform $duration ease

  background var(--bg)
  border $border solid #fafafa
  border-radius 100%
  cursor pointer
  height 44px
  left 50%
  position absolute
  top 50%
  transform translate(-50%, -50%) rotate(calc(var(--angle) * 1deg)) translateX(150px)
  width 44px

    transform translate(-50%, -50%) rotate(calc(var(--angle) * 1deg)) translateX(200px)

  border-color red
  border-width $border
  overflow hidden

    background #f22613
    content ''
    height $border
    left 50%
    position absolute
    top 50%
    transform translate(-50%, -50%) rotate(45deg)
    width 100%

              const duotone = document.querySelector('.duotone')
const choosers = {
  darken: document.querySelector('.chooser--darken'),
  lighten: document.querySelector('.chooser--lighten'),
const updateTone = (e) => {
  const {
  } = e.target
  duotone.style.setProperty(`--${name}`, value)
  choosers[name].style.setProperty('--selectedRotation', e.target.style.getPropertyValue('--angle'))
document.body.addEventListener('input', updateTone)
document.body.addEventListener('change', updateTone)
🕑 One or more of the npm packages you are using needs to be built. You're the first person to ever need it! We're building it right now and your preview will start updating again when it's ready.