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.


                <div id="red">Simple slide</div>
<div id="blue" style="background-color:blue">Mouse (click anywhere)</div>


                div {
  width: 200px;
  height: 100px;
  background-color: red;
  line-height: 100px;
  text-align: center;
  color: white;
  position: absolute;


                //every time the tween finishes, invalidate() and restart it from there."#red", 1, {x:"+=50", onComplete:function(){ 

var mouse = {x:500, y:200},
    //our tween will be called "follower" and it'll use function-based values to make things dynamic. 
    follower ="#blue", 1, {
      x:function() {
        return mouse.x;
      y:function() {
        return mouse.y;

//offset the blue box so that its center always lands on the mouse position rather than its top left corner.
TweenMax.set("#blue", {xPercent:-50, yPercent:-50});

//on click/tap, update the mouse position, invalidate the tween and restart it. 
$(window).on("mousedown touchstart pointerdown", function(event) {
  mouse.x = event.pageX;
  mouse.y = event.pageY;