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

              
                <h2>Prefers reduced motion</h2>
<div class="container">
  <div class="ball"></div>
</div>
<p>The Prefers reduced motion @media rule lets us tap into the users OS setting for users who prefer an motionless experience.</p>
<p>On Mac go to Preferences > Accessibility > Display > Reduce motion to make the ball stop moving.</p>
<p>In Windows 10 go to Settings > Ease of Access > Display > Show animations in Windows</p>
<p>In Windows 7: Control Panel > Ease of Access > Make the computer easier to see > Turn off all unnecessary animations (when possible).</p>
              
            
!

CSS

              
                body {
  display: grid;
  place-content: center;
  margin: 0;
  min-height: 100vh;
  background-color: hsl(222, 99%, 90%);
  font-family: sans-serif;
  line-height: 1.5rem;
  color: hsl(222, 99%, 18%);
}

h2, p {
  margin: 0 0 1rem 0;
  max-width: 50ch;
}

.container {
  margin-bottom: 1rem;
  height: 50px;
  background-color: hsl(222, 99%, 18%);
  position: relative;
  border-radius: 1000px;
}

.ball {
  width: 40px;
  height: 40px;
  position: absolute;
  left: 4%;
  top: 5px;
  background-color: hsl(222, 99%, 60%);
  border-radius: 50%;
  animation: moveball 1s ease-out alternate infinite;
}

@keyframes moveball {
  to {
      left: 88%;
  }
}

/* Remove animations if the user prefers reduced motion */
@media (prefers-reduced-motion) {
  .ball {
    animation: none;
  }
}
              
            
!

JS

              
                
              
            
!
999px

Console