octocatstartv

Pen Settings

CSS Base

Vendor Prefixing

Add External CSS

These stylesheets will be added in this order and before the code you write in the CSS editor. You can also add another Pen here, and it will pull the CSS from it. Try typing "font" or "ribbon" below.

Quick-add: + add another resource

Add External JavaScript

These scripts will run in this order and before the code in the JavaScript editor. You can also link to another Pen here, and it will run the JavaScript from it. Also try typing the name of any popular library.

Quick-add: + add another resource

Code Indentation

     

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.

            
              <div class="accordion">
  <div class="content">
    <input id="toggle1" type="checkbox" /><label for="toggle1">Short content</label>
    <div class="toggle">
      <p>Any amount of text can go in here</p>
    </div>
    <input id="toggle2" type="checkbox" /><label for="toggle2">Medium content</label>
    <div class="toggle">
      <p>Any amount of text can go in here</p>
      <p>Lorem ipsum dolor sit amet, consectetur adipiscing elit. Fusce eu augue et diam laoreet eleifend at vel sem. Aliquam erat volutpat. Duis quis ante vitae ipsum auctor malesuada sit amet ut diam. Curabitur dui tellus, condimentum faucibus bibendum vitae, gravida auctor turpis. Ut quis augue leo. Vivamus lacinia, mauris eu pellentesque semper, neque nulla porta erat, sit amet feugiat dui leo in enim. Donec ac dignissim metus. Aenean mollis, nibh ut tincidunt posuere, lacus purus ultricies nibh, ac dignissim purus elit at lorem. Etiam justo dui, aliquam vel varius eu, eleifend eget tortor. Aliquam vehicula malesuada aliquet. Sed gravida ipsum ut leo vestibulum blandit. Suspendisse hendrerit rutrum ligula, quis elementum nisi aliquet a.</p>
    </div>
    <input id="toggle3" type="checkbox" /><label for="toggle3">Lot of content</label>
    <div class="toggle">
      <p>Any amount of text can go in here</p>
      <p>Lorem ipsum dolor sit amet, consectetur adipiscing elit. Fusce eu augue et diam laoreet eleifend at vel sem. Aliquam erat volutpat. Duis quis ante vitae ipsum auctor malesuada sit amet ut diam. Curabitur dui tellus, condimentum faucibus bibendum vitae, gravida auctor turpis. Ut quis augue leo. Vivamus lacinia, mauris eu pellentesque semper, neque nulla porta erat, sit amet feugiat dui leo in enim. Donec ac dignissim metus. Aenean mollis, nibh ut tincidunt posuere, lacus purus ultricies nibh, ac dignissim purus elit at lorem. Etiam justo dui, aliquam vel varius eu, eleifend eget tortor. Aliquam vehicula malesuada aliquet. Sed gravida ipsum ut leo vestibulum blandit. Suspendisse hendrerit rutrum ligula, quis elementum nisi aliquet a.</p>
      <p>Lorem ipsum dolor sit amet, consectetur adipiscing elit. Fusce eu augue et diam laoreet eleifend at vel sem. Aliquam erat volutpat. Duis quis ante vitae ipsum auctor malesuada sit amet ut diam. Curabitur dui tellus, condimentum faucibus bibendum vitae, gravida auctor turpis. Ut quis augue leo. Vivamus lacinia, mauris eu pellentesque semper, neque nulla porta erat, sit amet feugiat dui leo in enim. Donec ac dignissim metus. Aenean mollis, nibh ut tincidunt posuere, lacus purus ultricies nibh, ac dignissim purus elit at lorem. Etiam justo dui, aliquam vel varius eu, eleifend eget tortor. Aliquam vehicula malesuada aliquet. Sed gravida ipsum ut leo vestibulum blandit. Suspendisse hendrerit rutrum ligula, quis elementum nisi aliquet a.</p>
      <p>Lorem ipsum dolor sit amet, consectetur adipiscing elit. Fusce eu augue et diam laoreet eleifend at vel sem. Aliquam erat volutpat. Duis quis ante vitae ipsum auctor malesuada sit amet ut diam. Curabitur dui tellus, condimentum faucibus bibendum vitae, gravida auctor turpis. Ut quis augue leo. Vivamus lacinia, mauris eu pellentesque semper, neque nulla porta erat, sit amet feugiat dui leo in enim. Donec ac dignissim metus. Aenean mollis, nibh ut tincidunt posuere, lacus purus ultricies nibh, ac dignissim purus elit at lorem. Etiam justo dui, aliquam vel varius eu, eleifend eget tortor. Aliquam vehicula malesuada aliquet. Sed gravida ipsum ut leo vestibulum blandit. Suspendisse hendrerit rutrum ligula, quis elementum nisi aliquet a.</p>
      <div class="deal-breaker">THIS IS THE DEAL BREAKER</div>
    </div>
    <input id="toggle4" type="checkbox" /><label for="toggle4">More short content</label>
    <div class="toggle">
      <p>Any amount of text can go in here</p>
    </div>
  </div>
</div>
            
          
!
            
              .content {
  width: 20%;
}

.content > input[type="checkbox"] {
  display: none;
}

.deal-breaker {
  background: red;
  height: 2000px;
}

.content > label {
  background: gold;
  border: 1px solid darkgreen;
  cursor: pointer;
  display: block;
  margin-bottom: -1px;
  padding: 5px;
}

input:checked + label {
  background: green;
}

input + label + .toggle {
  background: black;
  color: white;
  height: 0;
  /*line-height: 0em;*/
  opacity: .5;
  overflow: hidden;
  padding: 0 5px;
  transition: all 1s ease-in-out;
}

input:checked + label + .toggle {
  /*line-height: 1em;*/
  height: auto;
  opacity: 1;
}

input + label + .toggle > *:first-child {
  margin-top: -100%;
  transition: all .75s ease-in-out;
}

input:checked + label + .toggle > *:first-child {
  margin-top: 1em;
}
            
          
!
999px
Close

Asset uploading is a PRO feature.

As a PRO member, you can drag-and-drop upload files here to use as resources. Images, Libraries, JSON data... anything you want. You can even edit them anytime, like any other code on CodePen.

Go PRO

Loading ..................

Console