Pen Settings

HTML

CSS

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

JavaScript

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

Packages

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.

Behavior

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.

HTML

              
                <section>
  <p>Scroll down please. Dolor sit amet consectetur adipisicing elit. Doloremque quis sequi eius optio unde nesciunt fugiat cum impedit? Tempore asperiores suscipit libero repudiandae id repellat nostrum molestias laudantium autem error!</p>
  <p>Tempore asperiores suscipit libero repudiandae id repellat nostrum molestias laudantium autem error!</p>
  <p>Lorem ipsum dolor sit amet consectetur adipisicing elit. Doloremque quis sequi eius optio unde nesciunt fugiat cum impedit? Tempore asperiores suscipit libero repudiandae id repellat nostrum molestias laudantium autem error!</p>
  <p>Tempore asperiores suscipit libero repudiandae id repellat nostrum molestias laudantium autem error!</p>
</section>

<section>
  <p>Lorem ipsum, dolor sit amet consectetur adipisicing elit. Ab, velit quam. Quidem accusantium quod distinctio cumque expedita accusamus delectus doloremque laborum sapiente, et reprehenderit! Vero facere eveniet accusamus architecto qui. Lorem ipsum dolor sit amet consectetur adipisicing elit. Reprehenderit ab, vel veritatis nobis aut fugiat, adipisci magni expedita recusandae libero ex nostrum sed aperiam quidem, beatae quos! Ipsa, possimus veniam! Lorem ipsum, dolor sit amet consectetur adipisicing elit. Temporibus voluptatum porro quaerat voluptatem ad iusto modi amet labore voluptate soluta, dicta fugiat praesentium assumenda rem. Voluptas porro libero quasi fugit?</p>
  <p>Vel veritatis nobis aut fugiat, adipisci magni expedita recusandae libero ex nostrum sed aperiam quidem, beatae quos! Ipsa, possimus veniam! Lorem ipsum, dolor sit amet consectetur adipisicing elit. Temporibus voluptatum porro quaerat voluptatem ad iusto modi amet labore voluptate soluta, dicta fugiat praesentium assumenda rem. Voluptas porro libero quasi fugit?</p>
  <div class="c2a_wrap">
    <a class="c2a">
      Click me
    </a>
  </div>
</section>

<section>
  <p>Lorem ipsum dolor sit amet consectetur adipisicing elit. Doloremque quis sequi eius optio unde nesciunt fugiat cum impedit? Tempore asperiores suscipit libero repudiandae id repellat nostrum molestias laudantium autem error!</p>
  <p>Tempore asperiores suscipit libero repudiandae id repellat nostrum molestias laudantium autem error!</p>
  <p>Lorem ipsum, dolor sit amet consectetur adipisicing elit. Ab, velit quam. Quidem accusantium quod distinctio cumque expedita accusamus delectus doloremque laborum sapiente, et reprehenderit! Vero facere eveniet accusamus architecto qui. Lorem ipsum dolor sit amet consectetur adipisicing elit. Reprehenderit ab, vel veritatis nobis aut fugiat, adipisci magni expedita recusandae libero ex nostrum sed aperiam quidem, beatae quos! Ipsa, possimus veniam! Lorem ipsum, dolor sit amet consectetur adipisicing elit. Temporibus voluptatum porro quaerat voluptatem ad iusto modi amet labore voluptate soluta, dicta fugiat praesentium assumenda rem. Voluptas porro libero quasi fugit?</p>
  <p>Vel veritatis nobis aut fugiat, adipisci magni expedita recusandae libero ex nostrum sed aperiam quidem, beatae quos! Ipsa, possimus veniam! Lorem ipsum, dolor sit amet consectetur adipisicing elit. Temporibus voluptatum porro quaerat voluptatem ad iusto modi amet labore voluptate soluta, dicta fugiat praesentium assumenda rem. Voluptas porro libero quasi fugit?</p>
</section>

<section>
  <p>Lorem ipsum, dolor sit amet consectetur adipisicing elit. Ab, velit quam. Quidem accusantium quod distinctio cumque expedita accusamus delectus doloremque laborum sapiente, et reprehenderit! Vero facere eveniet accusamus architecto qui. Lorem ipsum dolor sit amet consectetur adipisicing elit. Reprehenderit ab, vel veritatis nobis aut fugiat, adipisci magni expedita recusandae libero ex nostrum sed aperiam quidem, beatae quos! Ipsa, possimus veniam! Lorem ipsum, dolor sit amet consectetur adipisicing elit. Temporibus voluptatum porro quaerat voluptatem ad iusto modi amet labore voluptate soluta, dicta fugiat praesentium assumenda rem. Voluptas porro libero quasi fugit?</p>
</section>
              
            
!

CSS

              
                :root {
  font: 20px system-ui;
}

body {
  margin: 1rem;
  line-height: 1.5;
}

p {
  margin: 1rem 0;
}

section {
  max-width: 800px;
  margin: 0 auto;
}

.c2a {
  position: relative;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 1rem;
  background: black;
  color: white;
  border-radius: 3px;
  &.fixed {
    position: fixed;
    top: 1rem;
    right: 1rem;
  }
}

              
            
!

JS

              
                let c2a = document.querySelector(".c2a");
gsap.set(".c2a_wrap", {
  minHeight: c2a.clientHeight
});

ScrollTrigger.create({
  trigger: c2a,
  start: "top top+=40",
  onEnter: () => {
    let state = Flip.getState(c2a);
    c2a.classList.add("fixed");
    Flip.from(state, {
      simple: true
    });
  },
  onLeaveBack: () => {
    let state = Flip.getState(c2a);
    c2a.classList.remove("fixed");
    Flip.from(state, {
      simple: true
    });
  }
});

              
            
!
999px

Console