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.


                <p>The idea is to make a collapsible menu that can seemingly animate between 0 and auto height without using javascript.<br>It has to work on any background, such as a gradient or image, without blocking access to the element(s) below.<br>It needs to be dynamic; you should not have to calculate the height of the menu to animate it.<br>Lastly, it needs to correctly apply the chosen css transition easing and time (max-height animations, while easier, need a calculated value to transition correctly)</p>
<div class="block">
  <label for="trigger">Click me</label>
  <input type="checkbox" id="trigger">
  <div class="list">
      <li>item 1</li>
      <li>item 2</li>
      <li>item 3</li>
      <li>item 4</li>
      <li>item 5</li>
      <li>item 6</li>
<p>Red text <span>should</span> still be selectable while the menu is hidden. Lorem ipsum dolor sit amet, consectetur adipisicing elit. Maxime explicabo dolore autem fugit quisquam veniam cupiditate illum quibusdam consequatur qui, est harum ab, id sequi voluptatem! Dicta, voluptate ea impedit. Lorem ipsum dolor sit amet, consectetur adipisicing elit. Nisi recusandae tempore voluptate, magnam animi suscipit pariatur cupiditate ipsa consectetur mollitia ratione praesentium laudantium aspernatur modi dignissimos neque sint quibusdam sunt?</p>



                body {
  font-family: sans-serif;
  background: linear-gradient(to right,  rgba(30,87,153,1) 0%,rgba(125,185,232,1) 100%);
  color: #FFF;
h2 {
  font-weight: normal;
.block {
  margin: 50px;
  padding: 5px 0;
  position: relative;
.list {
  position: absolute;
  z-index: 10;
  top: 100%;
  left: 0;
  pointer-events: none;
  overflow: hidden; //we need to prevent this block from overlapping the elements below when the menu is hidden
ul {
  transform: translateY(-100%);
  margin: 0;
  padding: 0;
  background-color: #FFF;
  color: #000;
  transition: transform .5s ease;
  pointer-events: initial;
li {
  padding: 3px 50px;
  cursor: pointer;
li:hover {
  background-color: red;
label {
  cursor: pointer;
input {
  display: none;
input:checked + .list ul {
  transform: translateY(0);
span {
  color: red;