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. You can use the CSS from another Pen by using it's URL and the proper URL extention.

+ 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.


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.


  button Toggle
    li Vanilla JS
    li 60 FPS

//- div.container
//-   button Toggle
//-   ul.block.with-padding
//-     li One
//-     li Two

  button Toggle
    li One
    li Two
    li Three
    li Four
  button Toggle
    li One
    li Two
    li Three


  display: flex
  min-height: 100vh
  justify-content: space-around
  align-items: flex-start
  background: linear-gradient(to right top, #000000, #e5008d, #ff070b)
  user-select: none
  font-family: 'Titillium Web', sans-serif
  text-align: center
  margin: 40px
  flex: 1
  background: black
  border: black
  width: 100%
  color: white
  border-radius: .125em
  font: inherit
  padding: .75em 1em
  text-transform: uppercase
  letter-spacing: .1em
  box-shadow: 0 2px 3px 0 rgba(black,.5)
  cursor: pointer

  background: black  
  box-shadow: 0 2px 3px 0 rgba(black,.5)
  text-align: left
  font-size: 1.25em
  color: white
  list-style-type: none
  overflow: hidden
  padding: 0
  white-space: nowrap
  letter-spacing: .1em
    padding: 5em 0
    // box-sizing: border-box
      top: 1px solid magenta
      bottom: 2px solid magenta
    display: none
    padding: 1em .5em
    margin: 0 1em
    + li
      border-top: 1px solid white


                class slideToggler
  constructor: (@el) ->
    return unless @el

    window.addEventListener 'resize', @getHeight
  getHeight: =>
    clone = @el.cloneNode(true) = 'visibility: hidden; display: block; margin: -999px 0'
    @height = (@el.parentNode.appendChild clone).clientHeight
    return @height
  toggle: (time) =>
    time or= @height / 3 + 150
    currHeight = @el.clientHeight * (getComputedStyle(@el).display != 'none')
    [start, end] = if currHeight > @height/2 then [@height,0] else [0,@height]
    disp = end - start
    el = @el
    @el.classList[ if end is 0 then 'remove' else 'add' ] 'open' = "overflow: hidden; display: block;"

    init = (new Date).getTime()

    repeat = ->
      instance = (new Date).getTime() - init
      step = start + disp * instance / time
      if instance <= time = step + 'px' # if Math.floor(step) in [start..end]
      else = "display: #{if end is 0 then 'none' else 'block'}"

      repeatLoop = requestAnimationFrame(repeat)
      cancelAnimationFrame repeatLoop unless Math.floor(step) in [start..end]
for block in document.querySelectorAll('.block')
  block.toggler = new slideToggler block

for trigger in document.querySelectorAll('button')
  trigger.addEventListener 'click', ->