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.


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.


                <h1>Hover to reorder</h1>

<div class="group">
  <div class="box">1</div>
  <div class="box">2</div>
  <div class="box">3</div>
  <div class="box">4</div>


                body {
  color: #333;
  padding: 10px 24px;

h1 {
  font-weight: normal;
  font-size: 24px;

.group {
  width: 600px;
  height: 150px;
  padding: 4px;  
  background: #ddd;
  display: flex;
  flex-direction: row;  

.box {
  margin: 4px;
  padding: 8px;
  font-size: 18px;
  flex: 1;
  align-self: stretch;  
  &:nth-child(1) {
    background: rgba(63, 81, 181, 0.6);
  &:nth-child(2) {
    background: rgba(103, 58, 183, 0.6);
  &:nth-child(3) {
    background: rgba(33, 150, 243, 0.6);
  &:nth-child(4) {
    background: rgba(0, 188, 212, 0.6);

.group.reorder {
  .box:nth-child(1) {
    order: 2;
  .box:nth-child(2) {
    order: 4;
  .box:nth-child(3) {
    order: 1;
  .box:nth-child(4) {
    order: 3;



                // Forked from
// with a little Shoe added to the mix
// Safari suffers from the dread flickor
// I can only blame myself

class Box extends Shoe.Layer {
	constructor(element) {
		this.element = element
		this.x = element.offsetLeft;
		this.y = element.offsetTop;
		var animation = new Shoe.NumberType({
			duration: 0.5,
	layout() {
		this.x = this.element.offsetLeft;
		this.y = this.element.offsetTop;
	render() { = `translate3d(${this.x}px, ${this.y}px, 0px)`;

var container = document.querySelector(".group");
function layout() {
  // Firefox offsetLeft is incorrect on :hover, have to manually toggle className:
	var i = boxes.length;
	while (i--) {

var boxes = [];
var elements = document.querySelectorAll(".box");
var i = elements.length;
while (i--) {
	var box = new Box(elements[i]);
	boxes.push( box );