Pen Settings

HTML

CSS

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

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

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.

HTML

              
                <details class="details0">
  <summary>(0) CSS Transition All - Summary</summary>
  Background color animates, but height doesn't. You can't animate to an auto height, but a specific height doesn't (or, at least, it didn't in 2013) help. See #3.
</details>

<details class="details1">
  <summary>(1) CSS Transition (Auto) Height - Summary</summary>
  No wrapper, no heights set. No animation. You can't animate to an auto height, but a specific height doesn't (or, at least, it didn't in 2013) help. See #3.
</details>

<details class="details2">
  <summary>(2) CSS Transition (Auto) Height of Wrapper - Summary</summary>
  <div class="contents">Added wrapper, height: auto. Still no animation. You can't animate to an auto height, but a specific height doesn't (or, at least, it didn't in 2013) help. See #3.</div>
</details>

<details class="details3">
  <summary>(3) CSS Transition (Specific) Height - Summary</summary>
  No wrapper, specific heights set. Still no animation. Or, at least, not when this was originally created in 2013. As of 2016 (maybe earlier) it animates, albeit not ideally, in Chrome, Firefox, Opera, and Safari! <a href="https://wpdev.uservoice.com/forums/257854-microsoft-edge-developer/suggestions/6261266-details-summary-elements">IE and Edge don't support summary and details at all, remember</a>.
</details>

<details class="details4">
  <summary>(4) CSS Transition (Specific) Height of Wrapper - Summary</summary>
  <div class="contents">
    Wrapper with specific heights set. No animation. Still.
  </div>
</details>

<details class="details5">
  <summary>(5) CSS fadeInDown Animation - Summary</summary>
  Try using <a href="https://daneden.me/">Dan Eden's</a> fadeInDown to maybe fake it a little.  Animation.
</details>

<details class="details6">
  <summary>(6) CSS font-size Animation - Summary</summary>
  Try using <a href="http://stackoverflow.com/users/923745/steven-vachon">Seven Vachon's</a> comment regarding font-size technique to maybe fake it a little differently. Animation.
</details>

<details class="details7">
  <summary>(7) CSS font-size Animation - Summary</summary>
  <div class="content">
    Try using <a href="http://stackoverflow.com/users/923745/steven-vachon">Seven Vachon's</a> comment regarding font-size technique to maybe fake it a little differently. Animation.</div>
</details>

<div class="below">
  Example of contents below that would get pushed down or pulled up.
</div>
              
            
!

CSS

              
                /* everything */
.details0 { 
  transition: all 0.5s linear;
}

/* height only, no heights */
.details1 {
  transition: height 1s ease;
}

/* height only, auto heights */
.details2, .details2 .contents {
  transition: height 1s ease;
}
.details2:not([open]) { height: auto; }
.details2[open] { height: auto; }

/* specific heights */
.details3 {
  transition: height 1s ease;
}
.details3:not([open]) { height: 1.25em; }
.details3[open] { height: 3.75em; }

/* specific heights with wrapper */
.details4 .contents {
  transition: height 1s ease;
}
.details4:not([open]) .contents { height: 0; }
.details4[open] .contents { height: 1.25em; }

/* specific animation */
/* https://daneden.me/animate/ */
@keyframes fadeInDown {
	0% {
		opacity: 0;
		transform: translateY(-1.25em);
	}
	100% {
		opacity: 1;
		transform: translateY(0);
	}
}
.details5[open] {
	animation-name: fadeInDown;
  animation-duration: 0.5s;
}

/* animate font-size (for height: auto) */
@keyframes growAndFadeInFontSize {
	0% {
    font-size: 0;
    opacity: 0;
	}
	100% {
    font-size: 1em;
    opacity: 1;
	}
}
.details6[open] {
	animation-name: growAndFadeInFontSize;
  animation-duration: 500ms;
}

/* add wrapper, continue with font-size */
@keyframes invisiblyGrowFontSize {
	0% {
    font-size: 0;
    opacity: 0;
	}
	100% {
    font-size: 1em;
    opacity: 0;
	}
}
@keyframes fadeIn {
  0% {
    opacity: 0;
  }
	100% {
		opacity: 1;
	}
}
.details7[open] .content {
	animation-name: invisiblyGrowFontSize, fadeIn;
  animation-duration: 500ms, 200ms;
  animation-delay: 0ms, 500ms;
}

/* debugging colors */
details:not([open]) { background: rgba(0,0,255,0.15); }
details[open] { background: rgba(255,0,0,0.15); }
details:hover { background: rgba(0,255,0,0.15); }
.below { background: rgba(255,255,0,0.15); }

/* debugging styles */
html, details, summary { font-family: sans-serif; line-height: 1.25; }
details { margin-bottom: 0.25em; line-height: 1.25; }
              
            
!

JS

              
                
              
            
!
999px

Console