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

              
                <div class="wrapper wrapper1"  id="wrapper">
  <p class="click-text">
    What does Marsellus Wallace not look like? <span class="arrow"></span>
  </p>
  <ul>
    <li>Black</li>
    <li>Bald</li>
    <li>A Bitch</li>
  </ul>  
</div>

<div class="wrapper wrapper2"  id="wrapper2">
  <p class="click-text">
    Malkovich malkovich? <span class="arrow"></span>
  </p>
  <ul>
    <li>Malkovich</li>
    <li>Malkovich</li>
    <li>Malkovich</li>
  </ul>  
</div>

<div class="wrapper wrapper3"  id="wrapper3">
  <p class="click-text">
    What is your favourite colour? <span class="arrow"></span>
  </p>
  <ul>
    <li>Blue</li>
    <li>Yellow</li>
    <li>Not Sure</li>
  </ul>  
</div>
              
            
!

CSS

              
                body
  color: white
  font-family: sans-serif
  background-color: #616161
  font-family: 'Source Sans Pro', sans-serif

.wrapper
  margin: 40px auto
  width: 400px
  display: block
  text-align: center
  transition: 0.15s ease
  &.active
    .arrow 
      transform: rotate(45deg) translate(-5px,-5px)
      &:before
        transform: translate(10px,0)
      &:after
        transform: rotate(90deg) translate(10px,0)
    ul
      opacity: 0.3
      height: 108px
      
.wrapper2
  ul
    border: 1px solid rgba(255, 255, 255, 0.5)
  li
    &:first-child
      margin-top: 16px
    &:last-child
      margin-bottom: 3px
  &.active
    ul
      margin-top: 12px
    .arrow
      transform: rotate(45deg) translate(38px,38px)
      opacity: 0.6
      &:before
        transform: translate(5px,0)
      &:after
        transform: rotate(90deg) translate(5px,0)

.wrapper3
  .arrow
    transform: rotate(0)
    left: 0
    &:before, &:after
      background-color: transparent
      width: 3px
      height: 10px
      display: inline-block
      position: absolute
      border-bottom: 12px solid white
      top: 0
      left: 0
      transform: rotate(0)
    &:before
      transform: rotate(-135deg)
    &:after 
      transform: rotate(135deg)
      
  &.active
    .arrow
      transform: rotate(0)
      transform: translate(0, -6px)
      &:before
        transform: rotate(-45deg)
      &:after
        transform: rotate(45deg)
      
  

.arrow
  width: 13px
  height: 13px
  display: inline-block
  position: relative
  bottom: -5px
  left: -10px
  transition: 0.4s ease
  margin-top: 2px
  text-align: left
  transform: rotate(45deg)
  float: right
  &:before, &:after
    position: absolute
    content: ''
    display: inline-block
    width: 12px
    height: 3px
    background-color: #fff
    transition: 0.4s ease
  &:after
    position: absolute
    transform: rotate(90deg)
    top: -5px
    left: 5px
  
.click-text 
  display: block
  text-align: left
  padding: 0 12px 16px
  margin: 0
  cursor: pointer
  color: rgba(255, 255, 255, 0.3)
  border-bottom: 1px solid rgba(255, 255, 255, 0.2)
  transition: 0.15s ease
  &:hover
    color: rgba(255, 255, 255, 0.6)
    border-bottom-color: rgba(255, 255, 255, 0.4)
  
ul
  padding: 0
  margin: 0
  height: 0
  overflow: hidden
  opacity: 0
  transition: 0.4s ease
  border-bottom: 1px solid rgba(255, 255, 255, 0.5)

li
  list-style-type: none
  margin: 0 auto
  padding: 4px 12px
  text-align: left
  cursor: pointer
  &:first-child
    margin-top: 12px
  &:last-child
    margin-bottom: 12px


  
              
            
!

JS

              
                document.getElementById('wrapper').onclick = function() {

    var className = ' ' + wrapper.className + ' ';

    this.className = ~className.indexOf(' active ') ?
                         className.replace(' active ', ' ') :
                         this.className + ' active';
};

document.getElementById('wrapper2').onclick = function() {

    var className = ' ' + wrapper2.className + ' ';

    this.className = ~className.indexOf(' active ') ?
                         className.replace(' active ', ' ') :
                         this.className + ' active';
}

document.getElementById('wrapper3').onclick = function() {

    var className = ' ' + wrapper3.className + ' ';

    this.className = ~className.indexOf(' active ') ?
                         className.replace(' active ', ' ') :
                         this.className + ' active';
}
              
            
!
999px

Console