Pen Settings



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


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.


  .square.slow Left Translate

  button#work Execute long JS task
  button#start Start heavy JS loop
  button#stop Stop heavy JS loop


                body {
  background-image: linear-gradient(to bottom, #4D4D4D, #000);
  height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;

.wrapper {
  width: 600px;

.square {
  --size: 200px;
  --margin: 20px;

  height: var(--size);
  width: var(--size);
  background-image: linear-gradient(-60deg, #ff5858 0%, #f09819 100%);
  position: relative;
  margin: var(--margin);
  border-radius: 50%;
  left: 0;
  animation: 2s linear infinite alternate;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 800;
  color: #000;

.square.slow {
  animation-name: slow;
} {
  background-image: linear-gradient(to right, #43e97b 0%, #38f9d7 100%);
  animation-name: fast;

.button {
  background: white;
  color: black;
  border: 0;
  font-weight: 800;
  border-radius: 100px;
  padding: 10px 40px;
  margin: 20px;
  font-size: 0.7em;
  font-family: inherit;

@keyframes slow {
  to { left: calc(100% - var(--size) - var(--margin) * 2) }

@keyframes fast {
  to { transform: translateX(calc(600px - var(--size) - var(--margin) * 2)) }


                function longTask(el) {
  new Array(el).fill(1).map((e, i) => e * i);

let to;
function heavyLoop() {
  to = setTimeout(heavyLoop, 16);

document.getElementById('work').addEventListener('click', () => longTask(10000000));
document.getElementById('start').addEventListener('click', heavyLoop);
document.getElementById('stop').addEventListener('click', () => clearTimeout(to));
// heavyLoop();