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

              
                <!-- Once you have the css and html, all you have to do is add that class 'wiggle' to the stuff u wanna wiggle! -->
<h1 class="wiggle">Oooh so wiggly</h1>
              
            
!

CSS

              
                
/** THIS IS NECESSARY **/
.wiggle span {
  position: relative;
  transition: .5s top;
}

/** This is just here to make it look pretty >:-D **/
body {
  background-color: black;
  color: white;
  height: 100vh;
  width: 100vw;
  display: flex;
  align-items: center;
  justify-content: center;
}

h1 {
  font-style: italic;
}
              
            
!

JS

              
                const WIGGLE_OFFSET = 2; // This is like how far up and down the letters should go.
const WIGGLE_NUM_LET = 3; // This is how many letters should be in one 'wave'

// Run this when the page loads
let toWiggle = document.querySelectorAll(".wiggle");

[...toWiggle].forEach((text) => {
  wiggle(text);
});

/**
 * Given a single text element, makes the text wiggly
 * text {HTMLElement} - the page element that should be wiggled
 **/
function wiggle(text) {
  let words = text.textContent;

  text.classList.add("wiggle");
  text.innerHTML = "";

  for (let j = 0; j < words.length; j++) {
    let sp = document.createElement("span");
    sp.textContent = words[j];
    // Maybe some day these letters will be colorful...
    // sp.style.color = "hsl(" + Math.floor(Math.random() * 361) + ", 100%, 50%)";

    text.appendChild(sp);
  }

  let loop = 0;
  let timerId = setInterval(() => {
    for (let j = 0; j < words.length; j++) {
      let magicNumber = WIGGLE_NUM_LET * WIGGLE_OFFSET;
      let yCoord = ((magicNumber) + (WIGGLE_OFFSET * j) + (WIGGLE_OFFSET * loop)) % (magicNumber);

      text.children[j].style.top = yCoord + "px";
    }
    loop++;
  }, 300);
}

              
            
!
999px

Console