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

              
                <div class="keyboard">
  <span class="key">K</span>
  <span class="key">E</span>
  <span class="key">Y</span>
  <span class="key">B</span>
  <span class="key">O</span>
  <span class="key">A</span>
  <span class="key">R</span>
  <span class="key">D</span>
</div>



<!-- extra stuff -->


<!-- extra stuff -->
<div class="jux-linx">
  <a href="https://codepen.io/Juxtopposed/full/xxQMyqQ" target="blank">Original version with JS</a>

  <a href="https://x.com/juxtopposed/status/1691908961086378042?s=20">Explanation Thread</a>
</div>
              
            
!

CSS

              
                body {
  background-color: #101013;
  color: #fff;
  display: flex;
  justify-content: center;
  align-items: center;
  height: 100vh;
  
  font-family: "Poppins", sans-serif;
  font-weight: 900;
}


.key {
  font-size: 15vw;
  display: inline-block;
  letter-spacing: -1vw;
  transition: transform 0.2s;
}



@keyframes pressDown1 {
  30%,
  40%,
  100% {
    transform: translateY(0);
  }
  35% {
    transform: translateY(10px);
  }
}

@keyframes pressDown2 {
  70%,
  80%,
  100% {
    transform: translateY(0);
  }
  75% {
    transform: translateY(10px);
  }
}

@keyframes pressDown3 {
  30%,
  40%,
  100% {
    transform: translateY(0);
  }
  35% {
    transform: translateY(10px);
  }
}

@keyframes pressDown4 {
  40%,
  50%,
  100% {
    transform: translateY(0);
  }
  45% {
    transform: translateY(10px);
  }
}

@keyframes pressDown5 {
  20%,
  30%,
  100% {
    transform: translateY(0);
  }
  25% {
    transform: translateY(10px);
  }
}

@keyframes pressDown6 {
  60%,
  70%,
  100% {
    transform: translateY(0);
  }
  65% {
    transform: translateY(10px);
  }
}

@keyframes pressDown7 {
  10%,
  20%,
  100% {
    transform: translateY(0);
  }
  15% {
    transform: translateY(10px);
  }
}

@keyframes pressDown8 {
  35%,
  45%,
  100% {
    transform: translateY(0);
  }
  40% {
    transform: translateY(10px);
  }
}



.key:nth-child(1) {
  animation: pressDown1 2s infinite;
}

.key:nth-child(2) {
  animation: pressDown2 3s infinite;
}

.key:nth-child(3) {
  animation: pressDown3 4s infinite;
}

.key:nth-child(4) {
  animation: pressDown4 2.5s infinite;
}

.key:nth-child(5) {
  animation: pressDown5 2.5s infinite;
}

.key:nth-child(6) {
  animation: pressDown6 3.5s infinite;
}

.key:nth-child(7) {
  animation: pressDown7 2.2s infinite;
}

.key:nth-child(8) {
  animation: pressDown8 3.2s infinite;
}




/* extra stuff */
.jux-linx {
  display: flex;
  flex-direction: row;
  align-items: center;
  flex-wrap: wrap;
  justify-content: flex-start;
  gap: 10px;
  position: absolute;
  left: 20px;
  bottom: 20px;
}
a {
  text-decoration: none;
  font-family: "IBM Plex Sans", sans-serif;
  font-weight: 400;
  font-size: 16px;
  color: white;
  background-color: black;
  border: 1px solid rgba(255, 255, 255, 0.3);
  border-radius: 2px;
  padding: 5px 10px;
  transition: 0.1s all ease-in;
}

a:nth-child(1):hover {
  border: 1px solid rgba(255, 255, 255, 0.4);
  box-shadow: 0px 2px 0 #349eff;
}

a:nth-child(2):hover {
  border: 1px solid rgba(255, 255, 255, 0.4);
  box-shadow: 0px 2px 0 #ff5757;
}
              
            
!

JS

              
                
              
            
!
999px

Console