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

+ add another resource

JavaScript

Babel is required to process package imports. If you need a different preprocessor remove all packages first.

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

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

              
                <h2>Pure CSS accordion</h2>
  <div class = "accordion">
    <input type = "checkbox" id = "item1" name = "accordion1">
    <label for = "item1"><i class = "fa fa-check"></i>Content 1<i class = "fa fa-chevron-down"></i></label>
    <div id = "content1" class = "item">
      <h4>Title 1</h4>
      <p>Lorem ipsum dolor sit amet, consectetur adipiscing elit. Fusce eleifend id leo quis rutrum. Curabitur condimentum augue et dolor sodales, vel iaculis lacus feugiat.
      </p>
    </div>
    <input type = "checkbox" id = "item2" name = "accordion1">
    <label for = "item2"><i class = "fa fa-check"></i>Content 2<i class = "fa fa-chevron-down"></i></label>
    <div id = "content2" class = "item">
      <h4>Title 2</h4>
      <p>Cras pretium blandit nunc, maximus convallis elit eleifend id. Nullam non posuere eros, sit amet iaculis leo. Morbi tincidunt nibh quis magna dapibus, sit amet imperdiet massa blandit. Maecenas sapien erat, efficitur id est sed, facilisis malesuada magna. Vivamus interdum non urna vel placerat. Duis sed nunc nec mi posuere tempor at sit amet dui. Curabitur faucibus sapien a massa vestibulum, in bibendum orci pharetra.
      </p>
    </div>
    <input type = "checkbox" id = "item3" name = "accordion1">
    <label for = "item3"><i class = "fa fa-check"></i>Content 3<i class = "fa fa-chevron-down"></i></label>
    <div id = "content3" class = "item">
      <h4>Title 3</h4>
      <p>Nullam elementum mollis est et tincidunt. Proin luctus euismod nisi et accumsan. Curabitur rutrum nisi odio, ac feugiat dui iaculis at. In volutpat dui ipsum, ut vestibulum diam hendrerit sit amet. Praesent venenatis lorem ante, quis porta tortor fringilla congue. Morbi mauris massa, posuere consequat vulputate vel, rutrum sed ipsum. Sed sed interdum turpis. Class aptent taciti sociosqu ad litora torquent per conubia nostra, per inceptos himenaeos. Donec blandit, ligula vel semper ullamcorper.
      </p>
    </div>
    <input type = "checkbox" id = "item4" name = "accordion1">
    <label for = "item4"><i class = "fa fa-check"></i>Content 4<i class = "fa fa-chevron-down"></i></label>
    <div id = "content4" class = "item">
      <h4>Title 4</h4>
      <p>Nam ac commodo nibh. Praesent aliquet vehicula risus. Proin at urna eu ipsum vestibulum blandit eu nec est. Aliquam erat volutpat. Proin at elit sollicitudin, tempor mauris at, blandit leo. Nullam sed tortor tortor. Vestibulum mattis mollis posuere. Quisque accumsan quam at quam malesuada, id tempor ex pulvinar. In non vehicula urna, id consectetur mauris. Quisque eget tincidunt quam. Nullam ut ligula sit amet nunc dictum volutpat at ultrices dolor.
      </p>
    </div>
  </div>
              
            
!

CSS

              
                @import url(https://fonts.googleapis.com/css?family=Open+Sans:400,700,300);
body {
  font-family: 'Open Sans', Arial, sans-serif;
  padding: 30px;
}
h2 {
  text-align: center;
}
.accordion {
  max-width: 400px;
  margin: 0 auto;
}
.accordion input{
  display: none;
}
.accordion input + label {
  position: relative;
  display: block;
  cursor: pointer;
  font-weight: 700;
  font-size: 1em;
  padding: 10px 40px;
  color: #ddd;
  background: #363636;
  background: -webkit-linear-gradient(top, #363636 0%, #363636 50%, #454545 90%, #363636 100%);
}
.accordion label i {
  font-size: 0.9em;
  position: absolute;
  left: 15px;
  top: 14px;
}
.accordion label i.fa-chevron-down {
  right: 20px;
  left: auto;
  -webkit-transition: all 0.3s ease;
  -moz-transition: all 0.3s ease;
	-o-transition: all 0.3s ease;
	transition: all 0.3s ease;
}
.accordion input:checked + label {
  background: #0B94BF;
  color: #fff;
}
.accordion input:checked + label i.fa-chevron-down{
  -webkit-transform: rotate(180deg);
  -moz-transform: rotate(180deg);
	-ms-transform: rotate(180deg);
	-o-transform: rotate(180deg);
	transform: rotate(180deg);
}
.accordion input + label:hover {
  background: -webkit-linear-gradient(top, #009CCE 0%, #009CCE 50%, #00779D 90%, #009CCE 100%);
  color: #fff;
}
.accordion .item {
  transform: scaleY(0);
  transform-origin: top;
  max-height: 0px;
  overflow: hidden;
  position: relative;
  border: 1px solid #bbb;
  padding: 0 15px;
  font-weight: normal;
  font-size: 14px;
  background: #fff;
  color: #000;
  transition: all 0.3s ease-in-out;
}
#item1:checked ~ #content1,
#item2:checked ~ #content2,
#item3:checked ~ #content3,
#item4:checked ~ #content4 {
  max-height: 350px;
  transform: scaleY(1);
}
.accordion .item h4, .accordion .item p{
  margin: 0;
  padding: 0;
}
.accordion .item h4 {
  padding: 10px;
  border-bottom: 1px solid #bbb;
}
.accordion .item p {
  padding: 10px 0;
}
              
            
!

JS

              
                
              
            
!
999px

Console