cssAudio - ActiveCSS - ActiveGeneric - ActiveHTML - ActiveImage - ActiveJS - ActiveSVG - ActiveText - Activefile-genericVideo - Activehtmlicon-personicon-teamoctocatspinnerstartv

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 id="boxcontainer">
  <div class="boxes"></div>
  <div class="boxes"></div>
  <div class="boxes"></div>
  <div class="boxes"></div>
  <div class="boxes"></div>
</div>

<button onClick="document.getElementById('boxcontainer').classList.toggle('openbox')">Show/ Hide</button>
            
          
!
            
              #boxcontainer {
  display: flex;
}

#boxcontainer > div.boxes {
  margin-right: 10px;
  transition: all .5s;
}

#boxcontainer div.boxes {
  width: 70px;
  height: 70px;
  background: navy;
  -webkit-transform: translate3d(-100%, 0, 0);
  transform: translate3d(-100%, 0, 0);
  opacity: 0;
  margin-bottom: 1em;
}

#boxcontainer.openbox > div.boxes {
  -webkit-transform: translate3d(0, 0, 0);
  transform: translate3d(0, 0, 0);
  opacity: 1;
  transition: all .5s;
}
            
          
!
            
              function getcss3prop(cssprop) {
  var css3vendors = ['', '-moz-', '-webkit-', '-o-', '-ms-', '-khtml-']
  var root = document.documentElement

  function camelCase(str) {
    return str.replace(/\-([a-z])/gi, function(match, p1) { // p1 references submatch in parentheses
      return p1.toUpperCase() // convert first letter after "-" to uppercase
    })
  }
  for (var i = 0; i < css3vendors.length; i++) {
    var css3propcamel = camelCase(css3vendors[i] + cssprop)
    if (css3propcamel.substr(0, 2) == 'Ms') // if property starts with 'Ms'
      css3propcamel = 'm' + css3propcamel.substr(1) // Convert 'M' to lowercase
    if (css3propcamel in root.style)
      return css3propcamel
  }
  return undefined
}

var transitionDelay = getcss3prop('transition-delay')

var boxes = document.querySelectorAll('.boxes')
if (transitionDelay) {
  for (var i = 0; i < boxes.length; i++) {
    boxes[i].style[transitionDelay] = 0.5 * i + 's'
  }
}
            
          
!
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