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.


                <h3>Smoothly change flex direction with GSAP's Flip plugin</h3>

<button id="changeLayout" class="button">change</button>
<div class="group">
  <div class="box">Common "FLIP" techniques employed by other tools won't work with flex elements because of the way browsers handle width/height. 
  <div class="box">Simply set <code>absolute: true</code> to have GSAP's Flip plugin make the elements position: absolute during the flip to work around challenges with flex and grid layouts. 
  <div class="box">When the flip animation is done, elements get reverted back to their normal positioning and everything appears seamless.</div>
  <div class="box">Happy flipping!</div>
<a class="gsap-logo" target="_blank" href="">
  <img src="" alt="" />


                /* Typography */

@font-face {
  font-display: block;
  font-family: Mori;
  font-style: normal;
  font-weight: 400;
  src: url( format("woff");

@font-face {
  font-display: block;
  font-family: Mori;
  font-style: normal;
  font-weight: 600;
  src: url( format("woff");

@font-face {
  font-display: block;
  font-family: Fraktion Mono;
  font-style: normal;
  font-weight: 400;
  src: url(

:root {
  --color-shockingly-green: #0ae448;
  --color-just-black: #0e100f;
  --color-surface-white: #fffce1;
  --color-pink: #fec5fb;
  --color-shockingly-pink: #f100cb;
  --color-orangey: #ff8709;
  --color-lilac: #9d95ff;
  --color-lt-green: #abff84;
  --color-blue: #00bae2;
  --color-grey: gray;
  --color-surface75: #bbbaa6;
  --color-surface50: #7c7c6f;
  --color-surface25: #42433d;

body {
  color: var(--color-surface-white);
  background-color: var(--color-just-black);
  font-family: Mori, sans-serif;
  font-weight: 400;
  margin: 0;
  font-size: 1rem;
  line-height: 1.45;
  text-align: center;

.group.reorder {
  flex-direction: row;

h1 {
  font-weight: 400;

.group {
  width: 740px;
  height: auto;
  margin: 1rem auto;
  padding: 4px;
 border: solid 2px var(--color-surface-white);
  display: flex;
  flex-direction: column;
  overflow: hidden;
  color: var(--color-just-black);
  position: relative;
  border-radius: 10px;

.box {
  margin: 4px;
  padding: 8px;
  line-height: 28px;
  border-radius: 10px;
.box:nth-child(1) {
  background-color: var(--color-lilac);
.box:nth-child(2) {
   background-color: var(--color-blue);
.box:nth-child(3) {
  background-color: var(--color-orangey);
.box:nth-child(4) {
   background-color: var(--color-lt-green);

button {
  margin: 0 auto;
  display: inline-block;
  outline: none;
  padding: 8px 14px;
  background: var(--dark);
  border: solid 2px var(--color-surface-white);
  color: var(--light);
  text-decoration: none;
  border-radius: 99px;
  padding: 12px 25px;
  text-transform: uppercase;
  font-weight: 600;
  cursor: pointer;
  line-height: 18px;

.gsap-logo {
  width: 20vw;
  max-width: 90px;
  position: fixed;
  bottom: 15px;
  right: 15px;
  mix-blend-mode: difference;
  z-index: 9999;

img {
  max-width: 100%;



const group = document.querySelector(".group");

document.querySelector(".button").addEventListener("click", () => {
  // Get the initial state
  const state = Flip.getState(".group, .box");
  // toggle the flex direction
  Flip.from(state, {
    absolute: true, // uses position: absolute during the flip to work around flexbox challenges
    duration: 0.5, 
    stagger: 0.1,
    ease: "power1.inOut"
    // you can use any other tweening properties here too, like onComplete, onUpdate, delay, etc.