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. If you link to another Pen, it will include the CSS from that Pen. If the preprocessor matches, it will attempt to combine them before processing.

+ 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 class="wrapper">
  <div class="container"></div>



                html, body {
  height: 100%;

body {  
  background: black;  
  overflow: hidden;
  color: #ddd;

.wrapper {
  height: 100%;
  overflow: hidden;
  visibility: hidden;

.container {
  position: relative;
  background: #333;  
  min-height: 100%;
  padding: 6px 0 0 6px;
  width: 65%;

.container > div {
  width: 50px;
  height: 50px;  
  position: relative;
  float: left;  
  margin: 1px;
  border: 1px solid #111;



                var container = document.querySelector(".container");
var dummy = document.createElement("div");
var body  = document.body;
var ease  = Back.easeOut.config(0.5);
var total = 100;
var boxes = [];

Draggable.create(dummy, {
  trigger: ".wrapper",
  cursor:  "ew-resize",
  onDrag:  resize,
  onPress: resize

for (var i = 0; i < total; i++) {    
  var element = document.createElement("div");
  var color   = "hsla(" + i / total * 360 + ", 100%, 50%, 0.8)";

  // Set x value to put _gsTransform object on element
  TweenLite.set(element, { background: color, x: 0 });
  // Keep track of element, transforms, and last x/y position
  boxes[i] = {
    transform: element._gsTransform,
    element: element,        
    x: element.offsetLeft,
    y: element.offsetTop

window.addEventListener("resize", layout);

TweenLite.set(".wrapper", { autoAlpha: 1 });

function layout(render) {

  var i = boxes.length;
  while (i--) {
    var box = boxes[i];
    var lastX = box.x;
    var lastY = box.y;
    box.x = box.element.offsetLeft;
    box.y = box.element.offsetTop;
    // Continue if box hasn't moved
    if (lastX === box.x && lastY === box.y) continue;
    // Reversed delta values taking into account current transforms
    var dx = box.transform.x + lastX - box.x;
    var dy = box.transform.y + lastY - box.y;      

    // Tween to 0 to remove the transform
    TweenLite.fromTo(box.element, 1, { x: dx, y: dy }, { 
      x: 0, 
      y: 0, 
      ease: ease, 
      immediateRender: render

function resize(event) {
  var width = event.clientX / body.offsetWidth * 100 + "%";
  TweenLite.set(container, { width: width });