Pen Settings

HTML

CSS

CSS Base

Vendor Prefixing

Add External Stylesheets/Pens

Any URLs 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 its URL and the proper URL extension.

+ 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

Auto Save

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

              
                .stars
  each _ in Array(80)
    .star

.center
  .circle.circle--outer
  .circle.circle--inner
    .four.four--1 4
    .four.four--2 4
        
    .circle.oh
      .astronaut
        .astronaut-backpack
        .astronaut-head
        .astronaut-antena.antena--left
          .ear-down
          .ear-up
          .antena
          .antena-tip
          
        .astronaut-antena.antena--right
          .ear-down
          .ear-up
          .antena
          .antena-tip
          
        .astronaut-helmet
          .astronaut-glass
          .glow.glow--1
          .glow.glow--2
        
        .astronaut-body
        
      svg.astronaut-wire(viewBox="-9 -9 259 823" width="259" height="823")
        path(d="M241 0c-24 54-30 113-78 148S63 159 27 215c-35 55 32 102 73 141s103 94 98 166c-6 97-169 66-192 157-10 43-8 84 9 126" fill="none" stroke-width="6" stroke="#FFF")
      
      .circle.planet
        .craters
          .crater.crater--1
          .crater.crater--2
          .crater.crater--3
          .crater.crater--4
          .crater.crater--5
          .crater.crater--6
    
      .astronaut-hands
        .astronaut-hand.hand--left
          svg(width="35" height="75")
            path(d="M30.23 17.209c-7.925 5.118-11.657 12.786-11.226 22.975-7.113.934-12.948 4.345-18.44 5.117C-1.951 26.539 3.92 9.346 18.635 1.369 30.66-4.39 39.53 9.398 30.23 17.209z" fill="#D2D2D2")
            g(fill="none" stroke="#999" stroke-linecap="round")
              path(d="M11.78 6.977c7.983.129 13.547 3.968 16.308 11.111M4.67 17.161c7.307-.379 13.1 1.924 17.93 6.94")
              path(d="M.816 31.334c6.439-2.441 12.295-1.746 18.149 2.488" stroke-linejoin="round")
            g(fill="#fff")
              path(d="M7.721 37.171c5.875-1.994 12.264 1.156 14.258 7.031l1.218 3.588c1.995 5.875-1.156 12.264-7.03 14.258-5.875 1.995-12.264-1.156-14.259-7.031L.69 51.429c-1.994-5.875 1.156-12.263 7.031-14.258z")
              path(d="M7.829 38.159c5.794-1.967 12.094 1.14 14.061 6.934l5.044 14.855c1.967 5.794-1.14 12.095-6.934 14.062-5.794 1.967-12.095-1.14-14.062-6.934L.895 52.221c-1.967-5.794 1.14-12.095 6.934-14.062z")
              path(d="M16.863 39.472l12.879 7.384a3.876 3.876 0 0 1 1.433 5.287 3.875 3.875 0 0 1-5.286 1.433l-12.878-7.384a3.874 3.874 0 0 1-1.434-5.286 3.874 3.874 0 0 1 5.286-1.434z")

        .astronaut-hand.hand--right
          svg(width="35" height="75")
            path(d="M30.23 17.209c-7.925 5.118-11.657 12.786-11.226 22.975-7.113.934-12.948 4.345-18.44 5.117C-1.951 26.539 3.92 9.346 18.635 1.369 30.66-4.39 39.53 9.398 30.23 17.209z" fill="#D2D2D2")
            g(fill="none" stroke="#999" stroke-linecap="round")
              path(d="M11.78 6.977c7.983.129 13.547 3.968 16.308 11.111M4.67 17.161c7.307-.379 13.1 1.924 17.93 6.94")
              path(d="M.816 31.334c6.439-2.441 12.295-1.746 18.149 2.488" stroke-linejoin="round")
            g(fill="#fff")
              path(d="M7.721 37.171c5.875-1.994 12.264 1.156 14.258 7.031l1.218 3.588c1.995 5.875-1.156 12.264-7.03 14.258-5.875 1.995-12.264-1.156-14.259-7.031L.69 51.429c-1.994-5.875 1.156-12.263 7.031-14.258z")
              path(d="M7.829 38.159c5.794-1.967 12.094 1.14 14.061 6.934l5.044 14.855c1.967 5.794-1.14 12.095-6.934 14.062-5.794 1.967-12.095-1.14-14.062-6.934L.895 52.221c-1.967-5.794 1.14-12.095 6.934-14.062z")
              path(d="M16.863 39.472l12.879 7.384a3.876 3.876 0 0 1 1.433 5.287 3.875 3.875 0 0 1-5.286 1.433l-12.878-7.384a3.874 3.874 0 0 1-1.434-5.286 3.874 3.874 0 0 1 5.286-1.434z")

    .button GO HOME

  .sorry Oops! Sorry, page not found.



a(href='https://dribbble.com/shots/4571035-Error-404' class='inspiration' target='_blank' rel='noopener') inspiration

              
            
!

CSS

              
                
random(a, b)
  return math(math(0, 'random')*(b - a + 1) + a, 'floor')  

@keyframes blink
  0%
  100%
    transform: scale(1)
    opacity: 1
  50%
    transform: scale(0.4)
    opacity: 0.5

@keyframes floating
  0%
  100%
    transform: translate(random(-3, 3)px, random(-3, 3)px) rotate(random(-2, 2)deg)
  20%
    transform: translate(random(-3, 3)px, random(-3, 3)px) rotate(random(-2, 2)deg)
  40%
    transform: translate(random(-3, 3)px, random(-3, 3)px) rotate(random(-2, 2)deg)
  60%
    transform: translate(random(-3, 3)px, random(-3, 3)px) rotate(random(-2, 2)deg)
  80%
    transform: translate(random(-3, 3)px, random(-3, 3)px) rotate(random(-2, 2)deg)

*
  box-sizing: border-box
  
body
  width: 100vw
  height: 100vh
  overflow: hidden
  font-size: 12px
  background-image: linear-gradient(to right bottom, #a9347e, #4b32a7)
  font-family: 'Open Sans', sans-serif
  letter-spacing: 0.2px
  color: white

.inspiration
  position: fixed
  bottom: 0
  right: 0
  padding: 10px
  text-align: center
  text-decoration: none
  font-family: 'Gill Sans', sans-serif
  font-size: 14px
  color: #ff487f

.center
  position: relative
  top: 50%
  left: 50%
  transform: translate(-50%, -50%)
  transition: transform 0.5s
  z-index: 1
  
  @media screen and (max-height: 600px)
    transform: translate(-50%, -50%) scale(0.75)
  @media screen and (max-width: 400px)
    transform: translate(-50%, -50%) scale(0.6)

.star
  position: absolute
  z-index: 1

for i in (1..80)
  size = random(1, 4)px
  
  .star:nth-child({i})
    top: random(0, 99)vh
    left: random(0, 99)vw
    
    &:before
    &:after
      position: absolute
      content: ''
      background-color: white
      border-radius: 10px
      animation: blink 1.5s infinite
      animation-delay: i * -1s
    
    &:before
      top: (size/2)
      left: -(size/2)
      width: 3 * size
      height: size
    &:after
      top: -(size/2)
      left: (size/2)
      width: size
      height: 3 * size
    
.circle
  position: absolute
  top: 50%
  left: 50%
  transform: translate(-50%, -50%)
  border-radius: 50%

.circle--outer
  width: 550px
  height: 550px
  background-image: linear-gradient(to right bottom, #802b89, #5631a1)
  box-shadow: 0px 0px 20px -8px black

.circle--inner
  width: 355px
  height: 355px
  background-image: linear-gradient(to right bottom, #75278b, #5530a2)
  box-shadow: 0px 0px 20px -8px black

.four
  position: absolute
  font-size: 150px
  font-weight: 900
  text-shadow: 0px 2px 10px rgba(0, 0, 0, 0.5)
  user-select: none
  
.four--1
  top: 100px
  left: 30px
  z-index: 1
.four--2
  top: 100px
  left: 230px
  z-index: 3

.astronaut
  position: absolute
  top: -115px
  left: -30px
  transform: rotate(17deg)
  
  .astronaut-backpack
    width: 100px
    height: 100px
    background-color: #e3e3e3
    border-radius: 10px
 
  .antena--left
    left: 10px
  .antena--right
    right: 10px
    
  .astronaut-antena
    position: absolute
    top: -7px
    
    .ear-down
      position: absolute
      bottom: -5px
      width: 15px
      height: 20px
      border-radius: 5px
      background-color: #afafaf
      z-index: 1
      
    .ear-up
      position: relative
      width: 15px
      height: 20px
      border-radius: 5px
      background-color: #c3c3c3
      z-index: 2
      
    .antena
      position: absolute
      top: -29px
      width: 2px
      height: 30px
      border-radius: 5px
      background-color: #c3c3c3

    .antena-tip
      position: absolute
      top: -33px
      width: 6px
      height: 6px
      border-radius: 50%
      background-color: #c3c3c3

  .antena--left .antena
    left: 5px
  .antena--right .antena
    right: 5px
  .antena--left .antena-tip
    left: 3px
  .antena--right .antena-tip
    right: 3px
      
  .astronaut-helmet
    position: absolute
    top: -30px
    left: 50%
    width: 66px
    height: 66px
    border-radius: 50%
    background-color: white
    box-shadow: 0px 5px 1px -3px gray
    transform: translateX(-50%)
    z-index: 3
    overflow: hidden
    
  .astronaut-glass
    position: absolute
    top: 13px
    left: 5px
    width: 56px
    height: 56px
    background: #00202e
    border-radius: 10px
  
  .glow
    position: absolute
    border-radius: 50%
    background-color: #334d57
    
  .glow--1
    top: 25px
    left: 15px
    width: 17px
    height: 17px
  
  .glow--2
    top: 44px
    left: 13px
    width: 7px
    height: 7px
  
  .astronaut-body
    position: absolute
    top: 30px
    left: 50%
    width: 50px
    height: 50px
    background-color: #c3c3c3
    transform: translateX(-50%)

.astronaut-wire
  position: absolute
  top: -40px
  left: -260px
    
.astronaut-hands
  position: absolute
  top: -89px
  left: -23px
  width: 100px
  transform: rotate(17deg)
  z-index: 3

  .astronaut-hand
    position: absolute

  .hand--left
    left: -3px
  .hand--right
    transform: scaleX(-1)
    right: -3px

.oh
  transition: all 0.1s linear
  animation: floating 4s linear infinite
  z-index: 2

.planet
  background-color: #ff4980
  box-shadow: inset -6px -10px 0px 1px #cc3b6b, 0px 2px 10px rgba(0, 0, 0, 0.4)
  width: 155px
  height: 155px
  
.craters
  .crater
    position: absolute
    border-radius: 50%
    background-color: #c93667

  .crater--1
    width: 35px
    height: 35px
    top: 30px
    left: 25px
  .crater--2
    width: 23px
    height: 23px
    top: 20px
    left: 93px
  .crater--3
    width: 17px
    height: 17px
    top: 77px
    left: 17px
  .crater--4
    width: 10px
    height: 10px
    top: 90px
    left: 80px
  .crater--5
    width: 25px
    height: 25px
    top: 115px
    left: 50px
  .crater--6
    width: 13px
    height: 13px
    top: 118px
    left: 105px

.button
  position: absolute
  bottom: 30px
  left: 50%
  transform: translateX(-50%)
  padding: 8px 12px
  border: 1px solid white
  border-radius: 3px
  cursor: pointer
  z-index: 999
  
  &:active
    transform: translateX(-50%) scale(0.95)

.sorry
  position: absolute
  top: 210px
  left: 50%
  transform: translateX(-50%)
  font-size: 15px

              
            
!

JS

              
                /*
  Inspired by: "Error, 404"
  By: Sujeet Mishra
  Link: https://dribbble.com/shots/4571035-Error-404
*/

let oh = document.querySelector('.circle.oh')

document.addEventListener('mousemove', event => {
  let domainX = [0, document.body.clientWidth],
      domainY = [0, document.body.clientHeight],
      range = [-10, 10]
  
  let translate = {
    x: range[0] + (event.clientX - domainX[0]) * (range[1] - range[0])/(domainX[1] - domainX[0]),
    y: range[0] + (event.clientY - domainY[0]) * (range[1] - range[0])/(domainY[1] - domainY[0])
  }
  
  oh.style.animation = 'none'
  oh.style.transform = `translate(${translate.x}px, ${translate.y}px)`
})

document.addEventListener('mouseleave', event => {
  oh.style.animation = 'floating 3s linear infinite'
})

              
            
!
999px

Console