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>Lorem ipsum dolor sit amet, consectetur adipiscing elit. Phasellus sodales tempus accumsan. Suspendisse sit amet convallis turpis. Fusce auctor porttitor lobortis. Maecenas luctus sem vel lacinia tempor. Morbi sit amet turpis id ligula accumsan mattis. Proin lacinia, ipsum a dignissim tempor, risus dui aliquam felis, non eleifend urna nisl sed mauris. Nullam congue vestibulum venenatis.</div>

<p>0, 0</p>


                div {
  display: none;
  overflow: hidden;
  width: 500px;
  padding: 20px;
  background: lightblue;


                const div = document.querySelector('div');
const padding = '20px';
let isActive = false;

// -------------------------------- // --------------------------------

function logPadding() {
  gsap.set('p', { innerHTML: gsap.getProperty(div, "paddingTop") + ", " + gsap.getProperty(div, "paddingBottom") })

// -------------------------------- // --------------------------------

document.querySelector('button').addEventListener('click', () => {  
  if (isActive) {
  } else {

const hide = () => {
  isActive = false;, {  
    height: 0, 
    paddingTop: 0, 
    paddingBottom: 0, 
    overwrite: 'auto', 
    duration: 0.5, 
    ease: '',
    onComplete: () => onHideComplete(),
    onUpdate: () => logPadding()
  } );

const onHideComplete = () => { = 'none'; = padding; //set back to original paddingTop before animation started? = padding; //set back to original paddingBottom before animation started?

const show = () => {
  isActive = true; = 'block'; = 'auto';
  //const paddingTop = parseFloat(getComputedStyle(div).paddingTop); //best way to store this on first animation?
  const paddingTop = padding; = 0;
  //const paddingBottom = parseFloat(getComputedStyle(div).paddingBottom); //best way to store this on first animation?
  const paddingBottom = padding; = 0;
  const targetHeight = div.offsetHeight; //best way to store this on first animation? = 0;, { 
    height: targetHeight, 
    paddingTop: paddingTop, 
    paddingBottom: paddingBottom,
    overwrite: 'auto', 
    duration: 0.5,
    ease: 'power1.out',
    onUpdate: () => logPadding()
  } );