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

              
                #root
              
            
!

CSS

              
                *
  box-sizing border-box
  
body
#root
  min-height 100vh
  display flex
  align-items center
  flex-direction column
  justify-content center
  
#root > * + *
  margin-top 1rem
  
h1
  color red
  
  &.fullscreen
    color purple
    position absolute
    display block
    top 50vh
    left 50vw
    transform translate(-50%, -50%)
    font-size 50vmin
    line-height 100vh
    width 100vw
    text-align center
    
    span
      display inline-block
      animation float 1s calc(var(--d) * 1s) infinite linear
      
      &:nth-of-type(1)
        --d 0
      &:nth-of-type(2)
        --d -0.2
      &:nth-of-type(3)
        --d -0.4
      &:nth-of-type(4)
        --d -0.6        

      @keyframes float
        50%
          transform translate(0, -20%)
              
            
!

JS

              
                import React, { useEffect, useRef, useState, Fragment } from 'https://cdn.skypack.dev/react'
import { render } from 'https://cdn.skypack.dev/react-dom'

const useFull = (el) => {
  const [full, setFull] = useState(false)
  const revert = () => {
    if (!document.fullscreenElement) {
      setFull(false)
      document.removeEventListener('fullscreenchange', revert)
    }
  }
  useEffect(() => {
    if (full) {
      const elem = el.current
      if (elem.requestFullscreen) {
        elem.requestFullscreen();
        document.addEventListener('fullscreenchange', revert)
      } else if (elem.webkitRequestFullscreen) { /* Safari */
        elem.webkitRequestFullscreen();
        document.addEventListener('fullscreenchange', revert)
      } else if (elem.msRequestFullscreen) { /* IE11 */
        elem.msRequestFullscreen();
        document.addEventListener('fullscreenchange', revert)
      }
    }
    return () => {
      document.removeEventListener('fullscreenchange', revert)
    }
  }, [full])
  return [full, setFull]
}

const App = () => {
  const picRef = useRef(null)
  const [full, setFull] = useFull(picRef)
  return (
    <Fragment>
      <h1>useFull</h1>
      <button onClick={() => setFull(!full)}>Enter Full Screen</button>
      <h1 class={full ? 'fullscreen' : ''} ref={picRef} src="http://placekitten.com/g/300/300">
        <span>H</span><span>e</span><span>y</span><span>!</span></h1>
    </Fragment>
  )
}

render(<App/>, document.getElementById('root'))
              
            
!
999px

Console