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 Stylesheets/Pens

Any URL's added here will be added as <link>s in order, and before the CSS in the editor. If you link to another Pen, it will include the CSS from that Pen. If the preprocessor matches, it will attempt to combine them before processing.

Quick-add: + add another resource

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.

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">

  <!-- Panel 1 -->
  <div>
    <input type="radio" name="panel" id="panel-1">
    <label for="panel-1">Panel 1</label>
    <div class="accordion__content accordion__content--small">
      <h2 class="accordion__header">Header</h2>
      <p class="accordion__body">Lorem ipsum dolor sit amet, consectetur adipisicing elit. Iusto possimus at a cum saepe molestias modi illo facere ducimus voluptatibus praesentium deleniti fugiat ab error quia sit perspiciatis velit necessitatibus.Lorem ipsum dolor sit amet, consectetur adipisicing elit. Lorem ipsum dolor sit amet.</p>
    </div>
  </div>

  <!-- Panel 2 -->
  <div>
    <input type="radio" name="panel" id="panel-2">
    <label for="panel-2">Panel 2</label>
    <div class="accordion__content accordion__content--med">
      <h2 class="accordion__header">Header</h2>
      <p class="accordion__body">Lorem ipsum dolor sit amet, consectetur adipisicing elit. Iusto possimus at a cum saepe molestias modi illo facere ducimus voluptatibus praesentium deleniti fugiat ab error quia sit perspiciatis velit necessitatibus.Lorem ipsum dolor sit amet, consectetur adipisicing elit. Lorem ipsum dolor sit amet, consectetur adipisicing elit. Sapiente eligendi nulla illo culpa ab in at adipisci eveniet id itaque maxime soluta recusandae doloribus laboriosam dignissimos est aut cupiditate delectus.</p>
    </div>
  </div>

  <!-- Panel 3 -->
  <div>
    <input type="radio" name="panel" id="panel-3">
    <label for="panel-3">Panel 3</label>
    <div class="accordion__content accordion__content--small">
      <h2 class="accordion__header">Header</h2>
      <p class="accordion__body">Lorem ipsum dolor sit amet, consectetur adipisicing elit. Iusto possimus at a cum saepe molestias modi illo facere ducimus voluptatibus praesentium deleniti fugiat ab error quia sit perspiciatis velit necessitatibus.Lorem ipsum dolor sit amet, consectetur adipisicing elit.</p>
    </div>
  </div>

  <!-- Panel 4 -->
  <div>
    <input type="radio" name="panel" id="panel-4">
    <label for="panel-4">Panel 4</label>
    <div class="accordion__content accordion__content--large">
      <h2 class="accordion__header">Header</h2>
      <p class="accordion__body">Lorem ipsum dolor sit amet, consectetur adipisicing elit. Iusto possimus at a cum saepe molestias modi illo facere ducimus voluptatibus praesentium deleniti fugiat ab error quia sit perspiciatis velit necessitatibus.Lorem ipsum dolor sit amet, consectetur adipisicing elit. Lorem ipsum dolor sit amet, consectetur adipisicing elit. Assumenda odio provident ullam culpa rem tempora voluptatem inventore facere adipisci doloribus dolorum ad maxime itaque quasi animi aliquid voluptates rerum expedita? Lorem ipsum dolor sit amet, consectetur adipisicing elit. Qui culpa amet neque nostrum cumque eaque corrupti ad accusantium? Consectetur reiciendis ad earum aspernatur at quibusdam cupiditate rerum ipsam consequatur suscipit. Lorem ipsum dolor sit amet, consectetur adipisicing elit. Ab rem explicabo exercitationem unde harum? Iste nobis quae animi illum laborum incidunt hic illo ad repellat repudiandae et alias facere magni.</p>
    </div>
  </div>

</div><!-- .accordion -->
            
          
!
            
              /* 
* Typography
*/
@import url(https://fonts.googleapis.com/css?family=Open+Sans:400,700);


/*
* Color Variables
*/

$light-grey: #eee;
$med-grey: #666;
$dark-grey: #444;
$highlight-color: #27ae60;


/*
* Animation Variables
*/

$timing: .4s;
$ease: cubic-bezier(0.865, 0.140, 0.095, 0.870);


/* 
* Global
*/

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

/* 
* Base
*/

body {
  font-family: 'Open Sans', sans-serif;
  background: $light-grey;
  
  &:before {
    content: '';
    position: absolute;
    top: 0;
    right: 0;
    bottom: 0;
    left: 0;
    background: linear-gradient(to bottom, rgba(0,0,0,0) 0%,rgba(0,0,0,0.3) 100%);
  }
  
}


/*
* Accordion
*/

/* Basic Accordion Styles */
.accordion {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  width: 75%;
  box-shadow: 0 1px 8px rgba(#000,.25);
  
  
  /* Radio Inputs */
  input[name='panel'] {
    display: none;
  }

  /* Labels */
  label {
    position: relative;
    display: block;
    padding: 1em;
    background: linear-gradient(to bottom, rgba(254,254,254,1) 0%,rgba(209,209,209,1) 50%,rgba(219,219,219,1) 55%,rgba(226,226,226,1) 100%);
    border-top: 1px solid #fff;
    border-bottom: 1px solid rgba(#000,.15);
    box-shadow: inset 0 2px 0 #fff;
    font-size: 1.5em;
    text-shadow: 0 1px 0 rgba(#fff,.75);
    color: $med-grey;
    cursor: pointer;
    transition: all $timing $ease;
    
    &:after {
      content: '+';
      position: absolute;
      right: 1em;
      width: 1em;
      height: 1em;
      color: $light-grey;
      text-align: center;
      border-radius: 50%;
      background: $highlight-color;
      box-shadow: inset 0 1px 6px rgba(#000,.5), 0 1px 0 #fff;
      text-shadow: 0 1px 0 rgba(#000,.75);     
    }
    
    &:hover {
      color: $highlight-color;
    }
      
  }
  
  input:checked + label {
    color: $highlight-color;
    
    &:after {
      content: '-';
      /* adjsut line-height to vertically center icon */
      line-height: .8em;
    }
    
  }
  
  /* Panel Content */
  .accordion__content {
    overflow: hidden;
    height: 0px;
    position: relative;
    padding: 0 1.5em;
    box-shadow: inset 4px 0 0 0 $highlight-color, inset 0 3px 6px rgba(#000,.75);
    background: $dark-grey;
    background: linear-gradient(to bottom, rgba(68,68,68,1) 0%,rgba(34,34,34,1) 100%);
    color: $light-grey;
    transition: height $timing $ease;
    
    &:not(:last-of-type) {
      box-shadow: inset 0 -2px 2px rgba(#000,.25), inset 4px 0 0 0 $highlight-color, inset 0 3px 6px rgba(#000,.75);
    }
    
    .accordion__header {
      padding: 1em 0;
    }
      
    .accordion__body {
      font-size: .825em;
      line-height: 1.4em;
    }
    
  }
   
}


/* 
* Size Variations
*/

input[name='panel']:checked ~ .accordion__content.accordion__content--small {
  height: 150px;
}

input[name='panel']:checked ~ .accordion__content.accordion__content--med {
  height: 200px;
}

input[name='panel']:checked ~ .accordion__content.accordion__content--large {
  height: 300px;
}
            
          
!
999px
Loading ..................

Console