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.


                <!-- Created by Bennett Feely. -->

  <h1>Spring Physics and Velocity.js</h1>
    <span>[<div class="tension" contenteditable>500</div>, <div class="friction" contenteditable>20</div>]</span>
    <small>[tension, friction]</small></section>
    <div id="box"></div>
  "left": "500px"
}, 625, [<b id="code_tension">tension</b>, <b id="code_friction">friction</b>]);</code></pre>  


                @import url(,400,500,600,700);

$radius : .5rem;

body {
  font-family: "Source Code pro", monospace;
  background: whitesmoke;

h1 {
  text-transform: uppercase;
  font-size: 1.4rem;
  font-weight: 300;

main {
  width: 30rem;
  margin: 0 auto;

section {
  text-align: left;
  position: relative;
  display: inline-block;
  background: white;
  padding: .75rem 1rem;
  padding-right: 5rem;
  font-size: 2em;
  font-family: monospace;
  border-radius: .5rem;
  box-shadow: 0 .125rem lightgray;
  overflow: hidden;

small {
  display: block;
  font-size: .8rem;
  margin-top: 1em;
  padding-bottom: .25rem;
  transition: .3s;

  section:hover & {
    color: black;

[contenteditable] {
  display: inline-block;
  text-align: center;
  min-width: 1em;
  border: 0;
  background: white;
  border-radius: $radius;
  transition: .3s;
  vertical-align: -10%;
  span:hover & {
    background: #ffa;
  section:hover &:focus {
    outline: 0;
    background: yellow;
    padding: 0 .25em;

button {
  display: inline-block;
  position: absolute;
  top: 0;
  right: 0;
  border: 0;
  background: lightgreen;
  padding: .25em .5em;
  border-top-right-radius: $radius;
  box-shadow: inset 0 -.125rem rgba(0,0,0,.1);
  transition: .4s;
  transform-origin: top right;
  &:hover {
    background: darken(lightgreen, 20%);
    transition: .2s;
  &:active {
    transform: scale(1.1);
    transition: 0;
  &:focus {
    outline: 0;

#box {
  width: 100px;
  height: 100px;
  margin-top: 1em;
  transform-origin: 0 0;
  background: darkgray;
  border-radius: $radius;
  position: relative;

pre {
  display: inline-block;
  font-size: .9rem;
  text-align: left;
  background: rgba(black, .05);
  margin-top: 1rem;
  padding: 1.5rem 2rem;
  border-radius: $radius;
  box-shadow: inset 0 .125rem gainsboro;


                var $box = $("#box");


function spring() {
  var tension = $(".tension").text(),
      friction = $(".friction").text();
      left: "300px"  
    }, 625, [tension, friction])