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. You can use the CSS from another Pen by using it's URL and the proper URL extention.

+ 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

              
                <h1>CSS3 Accordion Test (No <code>height: auto</code> transition)</h1>
<div class="accordion">
  <ul>
    <li>
      <a href="#" class="acc-handle" tabindex="0">Accordion 1</a>
      <div class="acc-panel">
        <p>Pellentesque habitant morbi tristique senectus et netus et malesuada fames ac turpis egestas.</p>
      </div>
    </li>
    <li>
      <a href="#" class="acc-handle" tabindex="0">Accordion 2</a>
      <div class="acc-panel">
        <p>
          Vestibulum erat wisi, condimentum sed, commodo vitae, ornare sit amet, wisi. Aenean fermentum, elit eget tincidunt condimentum, eros ipsum rutrum orci, sagittis tempus lacus enim ac dui. Donec non enim in turpis pulvinar facilisis. Ut felis. Praesent dapibus, neque id cursus faucibus, tortor neque egestas augue, eu vulputate magna eros eu erat. Aliquam erat volutpat. Nam dui mi, tincidunt quis, accumsan porttitor, facilisis luctus, metus
        </p>
      </div>
    </li>
    <li>
      <a href="#" class="acc-handle" tabindex="0">Accordion 3</a>
      <div class="acc-panel">
        <img src="http://placekitten.com/g/100/100" height="100px" width="100px">
        <p>
          Praesent dapibus, neque id cursus faucibus, tortor neque egestas augue, eu vulputate magna eros eu erat. Aliquam erat volutpat. Nam dui mi, tincidunt quis, accumsan porttitor, facilisis luctus, metus
        </p>
      </div>
    </li>
    <li>
      <a href="#" class="acc-handle" tabindex="0">Accordion 4</a>
      <div class="acc-panel">
        <dl>
           <dt>Definition list</dt>
           <dd>Consectetur adipisicing elit, sed do eiusmod tempor incididunt ut labore et dolore magna  aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea  commodo consequat.</dd>
           <dt>Lorem ipsum dolor sit amet</dt>
           <dd>Consectetur adipisicing elit, sed do eiusmod tempor incididunt ut labore et dolore magna  aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat.</dd>
        </dl>
      </div>
    </li>
    <li>
      <a href="#" class="acc-handle" tabindex="0">Accordion 5</a>
      <div class="acc-panel">
        <ul>
           <li>Lorem ipsum dolor sit amet, consectetuer adipiscing elit.</li>
           <li>Aliquam tincidunt mauris eu risus.</li>
           <li>Vestibulum auctor dapibus neque.</li>
        </ul>
      </div>
    </li>
  </ul>
</div>
<blockquote>one does not simply animate <code>height: auto</code></blockquote>
              
            
!

CSS

              
                *, *:before, *:after {
  box-sizing: border-box;
}

html {
  height: 100%;
}

body {
  height: 100%;
  background: #2C3E50;
  font-family: Corbel, "Lucida Grande", "Lucida Sans Unicode", "Lucida Sans", "DejaVu Sans", "Bitstream Vera Sans", "Liberation Sans", Verdana, "Verdana Ref", sans-serif;
}

h1, blockquote {
  color: #fafafa;
  text-align: center;
}

code {
  font-family: Consolas, "Andale Mono WT", "Andale Mono", "Lucida Console", "Lucida Sans Typewriter", "DejaVu Sans Mono", "Bitstream Vera Sans Mono", "Liberation Mono", "Nimbus Mono L", Monaco, "Courier New", Courier, monospace; 
  margin: 0 0.1em;
  background: #1B2938;
  padding: 0 0.5em 0.2em;
}

img {
  float: left;
  margin: 0 1em 0 0;
}

p {
  margin: 0 0 1.5em 0; 
}

.accordion {
  display:block;
  position: relative;
  width: 500px;
  margin: 10px auto;
  height: auto;
  box-shadow: 0 2px 5px rgba(0,0,0,.25);
}

.accordion > ul {
  display: block;
  list-style: none;
  padding :0;
  margin: 0;
}

.accordion > ul > li {
  display: block;
  position: relative;
  margin-bottom: -1px;
  overflow: hidden;
  color: #486992;
  background: #fafafa;
  border: 1px solid #D1D1D1;
}

.accordion > ul > li:first-child {
  border-radius: 0.3em 0.3em 0 0;
}

.accordion > ul > li:last-child {
  border-radius: 0 0 0.3em 0.3em;
}

.acc-handle {
  display:block;
  position: relative;
  padding: 1.5em;
  color: #486992;
  background: #f1f1f1;
  text-decoration: none;
  z-index: 3;
  box-shadow: inset 0 1px 0 rgba(255,255,255,0.8);
  transition: all .25s ease;
}

.acc-handle:hover {
  color: #2F71C4;
  background: #fafafa;
}

.acc-handle:before, .acc-handle:after {
  content: '';
  position: absolute;
  transition: all .3s ease;
}

.acc-handle:before {
  width: 1em;
  border-top: .15em solid;
  border-bottom: .15em solid;
  top: 50%;
  margin-top: -0.15em; 
  right: 1.45em;
}

.acc-handle:after {
  height: 1em;
  width: 0.3em;
  border-top: 0.5em solid;
  border-bottom: 0.5em solid;
  right: 1.8em;
  top: 50%;
  margin-top: -0.55em;
}

.acc-panel {
  padding: 1.5em;
  position: relative;
  float: left;
  width: 100%;
  clear: both;
  margin-top: -100%;
  z-index: 1;
  transition: all 1.2s ease;
}

.acc-handle:focus {
  outline: none;
  background: #e7e7e7;
}

.acc-handle:focus:after{
  height: 0;
  border: 0;
  margin-top: 0;
  opacity: 0;
}

.acc-handle:focus + .acc-panel {
  margin-top: 0;
  border-top: 1px solid #d1d1d1;
  transition: all 0.6s ease-in-out;
}

.acc-panel * { 
  opacity: 0;
  transition: all 1s linear;
}

.acc-handle:focus + .acc-panel * {
  opacity: 1;
}
              
            
!

JS

              
                
              
            
!
999px

Console