cssAudio - Activefile-genericCSS - ActiveGeneric - ActiveHTML - ActiveImage - ActiveJS - ActiveSVG - ActiveText - Activefile-genericVideo - ActiveLovehtmlicon-new-collectionicon-personicon-teamlog-outoctocatpop-outspinnerstartv

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="container">
  <div class="accordion_container">
    <input type="checkbox"
           id="accordion-1" 
           class="accordion-control">
    <label for="accordion-1"
           class="accordion-label" 
           data-label-closed="show" 
           data-label-open="hide">Click to</label>
    <div class="accordion-content">
      This is collapsible content
    </div>
  </div>
</div>

<div class="normal content">
  This is non-collabsible content
</div>

<fieldset class="accordion-group-container">
  
  <div class="accordion_container">
    <input type="radio" 
           name="accordiongroup"
           id="accordiongroup-1"
           class="accordion-control">
    <label for="accordiongroup-1"
           class="accordion-label">
      Accordion group - Title 1
    </label>
    <div class="accordion-content content-1">
      This is collapsible content
      <br><br><br><br><br><br><br><br>
    </div>
  </div>
  
  <div class="accordion_container">
    <input type="radio" 
           name="accordiongroup" 
           id="accordiongroup-2"
           class="accordion-control">
    <label for="accordiongroup-2" 
           class="accordion-label">
      Accordion group - Title 2
    </label>
    <div class="accordion-content content-2">
      This is collapsible content
      <br><br><br><br><br><br><br><br>
    </div>
  </div>
  
  <div class="accordion_container">
    <input type="radio" 
           name="accordiongroup" 
           id="accordiongroup-3"
           class="accordion-control">
    <label for="accordiongroup-3" 
           class="accordion-label">
      Accordion group - Title 3
    </label>
    <div class="accordion-content content-3">
      This is collapsible content
      <br><br><br><br><br><br><br><br>
    </div>
  </div>
  
</fieldset>

<div class="normal content">
  This is non-collabsible content
</div>
            
          
!
            
              body{
  padding : 20px;
  font-size: 28px;
  font-family: helvetica;
}
.accordion-label{
  cursor:pointer;
  display:block;
}
.accordion_container{
  background:#ccc;
  padding:20px;
  border-bottom:1px solid #aaa;
  &:first-of-type{
    border-top-left-radius:20px;
    border-top-right-radius:20px;
  }
  &:last-of-type{
    border-bottom-left-radius:20px;
    border-bottom-right-radius:20px;
    border-bottom: none;
  }
}
.accordion-content{
  /* Height animation:
  only really works well if the height is close to content - too high and the animation still goes to the max-height number, messing up the timing
  For widely variable height content, best not to animate. Switch display attribute instead */
  max-height:0;
  overflow: hidden;
  transition : max-height 0.2s;
  background-size: 260px;
  background-repeat: no-repeat;
  background-position: center;
}
.accordion-control{
  display:none;
  + label{
    position     : relative;
    height       : 40px;
    margin-left  : 20px;
    padding-left : 5px; 
    display      : block;
    font-family  : arial;
    font-size    : 1em;
    line-height  : 1em;
    z-index      : 0;
    &:before,
    &:after
    {
      content    : '';
      position   : absolute;
    }
    &:before{
      left: -19px;
      top: 3px;
      width: 0;
      height: 0;
      border-style: solid;
      border-width: 10px 0 10px 16px;
      border-color: transparent transparent transparent #666;
      transition : all 0.2s ease-in;
    }
    &:after{
      
      content: attr(data-label-closed);
      padding-left: 4px;
    }
  }
  
  &:checked {
    + label{
      cursor:pointer;
      &:before{
        transform: rotate(90deg);
      }
      &:after{
        content: attr(data-label-open);
      }
      + .accordion-content{
        max-height:350px;
      }
    }
  }
  &[type="radio"]{
    + label{
      &:before,
      &:after{
        content:'';
      }
    }
    &:checked{
      + label{
        cursor:default;
        &:before{
          border-left-color:#999;
        }
      }
    }
  }
}

.content-1{
  background-image:url('https://blog.absolutedisaster.co.uk/profile/Dark-Mills-I.jpg');
}

.content-2{
  background-image:url('https://blog.absolutedisaster.co.uk/profile/Dark-Mills-II.jpg');
}

.content-3{
  background-image:url('https://blog.absolutedisaster.co.uk/profile/Torquemada.jpg');
}

fieldset{
  border:none;
  padding: 0;
}
            
          
!
999px
Loading ..................

Console