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

              
                <div class="accordion"> 
  
  <a href="#" class="accordion-toggle">Hover for height animate</a>
  <div class="accordion-content">
    <div class="accordion-inner"> 
      <p>For animate the "height" of element with CSS Transitions you need use "max-height".</p>
      <p>If use the "height: auto", the effect not works. Is necessary some value for the CSS create a CSS animate, and you can use "max-height" with a great value for emulate this effect.</p> 
    </div>
  </div>
</div>
              
            
!

CSS

              
                body{
  font-family: helvetica;
  font-size: 18px;
  text-align: center;
}

.accordion{ 
  display: inline-block;
  text-align: left;
  margin: 1%;
  width: 70%; 
  
  &:hover{
  
    // max-height technique
    .accordion-content{
      // If use the "height: auto", the effect not works. Is necessary some value for the CSS create a CSS animate, and we can use "max-height" with a great value for emulate this effect.
      max-height: 300px;
    }
  
  }
}

.accordion-content{
  -webkit-transition: max-height 1s; 
  -moz-transition: max-height 1s; 
  -ms-transition: max-height 1s; 
  -o-transition: max-height 1s; 
  transition: max-height 1s;  
  background: #e5feff;
  overflow: hidden;
  // "height: 0" not work with css transitions
  max-height: 0;
}

.accordion-inner{
  padding: 0 15px;
}

.accordion-toggle{
  -webkit-transition: background .1s linear;   
  -moz-transition: background .1s linear;   
  -ms-transition: background .1s linear;   
  -o-transition: background .1s linear;   
  transition: background .1s linear;   
  background: #00b8c9;
  border-radius: 3px;
  color: #fff;
  display: block;
  font-size: 30px;
  margin: 0 0 10px;
  padding: 10px;
  text-align: center;
  text-decoration: none;
  
  &:hover{
    background: darken(#00b8c9, 15%);
  }
  
}


              
            
!

JS

              
                
              
            
!
999px

Console