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


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 Start Screensaver


  box-sizing border-box

  min-height 100vh

  position fixed
  top 0
  right 0
  bottom 0
  left 0
  height 100vh
  width 100vw
  background hsl(0, 10%, 10%)

  position fixed
  top 50%
  left 50%
  z-index 2
  transform translate(-50%, -50%)
  padding 1rem 2rem
  border-radius 0.5rem
  font-family sans-serif
  font-weight bold
  font-size 1.25rem



                const CANVAS = document.querySelector('canvas')
const CONTEXT = CANVAS.getContext('2d')
let RUN = false

const DRAW = () => {
  if (RUN) {
    CONTEXT.clearRect(0, 0, window.innerWidth, window.innerHeight)
    PARTICLES.forEach(p => {
      CONTEXT.fillStyle = `hsla(0, 0%, 100%, ${p.o})`
      p.x += Math.cos(p.a) + p.s
      p.y += Math.sin(p.a) + p.s
      if (p.x > window.innerWidth) p.x = 0
      if (p.x < 0) p.x = window.innerWidth
      if (p.y > window.innerHeight) p.y = 0
      if (p.y < 0) p.y = window.innerHeight
      CONTEXT.fillRect(p.x, p.y, p.d, p.d)

const BUTTON = document.querySelector('button')
BUTTON.addEventListener('click', () => CANVAS.requestFullscreen())

document.addEventListener('fullscreenchange', () => {
  if (document.fullscreenElement) {
    setTimeout(() => {
      CANVAS.width = CONTEXT.width = window.innerWidth
      CANVAS.height = CONTEXT.height = window.innerHeight
      PARTICLES = new Array(150).fill().map(() => ({
        x: Math.random() * window.innerWidth,
        y: Math.random() * window.innerHeight,
        a: Math.random() * (Math.PI * 2),
        s: Math.random() * 10,
        d: Math.random() * 5,
        o: Math.random(),
      document.addEventListener('pointermove', document.exitFullscreen)
      RUN = true
    }, 1000)
  } else {
    document.removeEventListener('pointermove', document.exitFullscreen)
    CONTEXT.clearRect(0, 0, CANVAS.width, CANVAS.width)
    RUN = false