Pen Settings



CSS Base

Vendor Prefixing

Add External Stylesheets/Pens

Any URL's 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 it's URL and the proper URL extention.

+ 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.


                <h1>Hit the circle </h1>
<svg height="150" width="100%">
  <circle id="catch-me" r="50" cy="75">
    <animate attributeName="cx"
             calcMode="paced" />
<ul id="log"></ul>
<p>Although the circle is animated using SMIL, the SVG DOM still provides a way to figure out exactly where it is (i.e., the current value of the <code>cx</code> attribute) at the time of processing the event.  Every time the circle receives a mousedown event, it will be logged above.
<p>P.S.: I'm using a mousedown event, because very few click events were getting through—the circle was moving out from under the mouse before the mouseup (and therefore click) was getting processed. If the circle is still moving too fast, increase the <code>dur</code> attribute, or reduce the width of the frame.</p>


                circle#catch-me {
circle#catch-me:hover {
svg {
  background: linear-gradient(to bottom, lightyellow 10%, tomato 40%, darkred, tomato 60%, lightyellow 90%);
h1 {
  position: absolute;
  width: 100%;
  text-align: center;
  text-shadow: 0 0 0.3em #eee, 0 0 0.1em #eee;
  pointer-events: none;
body:hover h1 {
  opacity: 0.2;
ul#log:not(:empty) {
  padding-bottom: 1em;
  border-bottom: gray 2px solid;


                var log = document.getElementById("log");
        .addEventListener("mousedown", logAnimations);

function logAnimations(e){
  var c =,
      l = document.createElement("li");
  l.textContent = ["Clicked at ",
                   " (",
  log.insertBefore(l, null);