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.

            
              This example is not mine, it belongs to this course --->
<a href="https://javascript30.com/">javascript30.com</a> 


Author <a href="https://twitter.com/wesbos">@Wes Bos</a>




<div class="panels">
  <div class="panel panel1">
    <p>Hey </p>
    <p>Let´s</p>
    <p>Dance</p>
  </div>
  <div class="panel panel2">
    <p>Give</p>
    <p>Take</p>
    <p>Recive</p>
  </div>
  <div class="panel panel3">
    <p>Experience</p>
    <p>It</p>
    <p>Today</p>
  </div>
  <div class="panel panel4">
    <p>Give</p>
    <p>All</p>
    <p>You</p>
  </div>
  <div class="panel panel5">
    <p>Life</p>
    <p>In</p>
    <p>Motions</p>
  </div>
</div>
            
          
!
            
              html {
  background: #ffc600;
  font-size: 20px;
  font-weight: 200;
}

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

.panels {
  min-height: 100vh;
  overflow: hidden;
  display: flex;
}

.panel {
  background: #6b0f9c;
/*   box-shadow: inset 0 0 0 5px rgba(255, 255, 255, 0.1); */
  color: #fff;
  text-align: center;
  transition: font-size 0.7s cubic-bezier(0.67, -0.19, 0.7, -0.11), flex 0.7s cubic-bezier(0.61, -0.19, 0.7, -0.11), backgrond 0.2s;
  font-size: 20px;
  background-size: cover;
  background-position: center;
  flex-grow: 1;
  justify-content: center;
  align-items:center;
  display: flex;
  flex-direction: column;
}

.panel1 {
  background-image: url(https://source.unsplash.com/user/erondu);
}

.panel2 {
  background-image: url(https://source.unsplash.com/user/ak96);
}

.panel3 {
  background-image: url(https://source.unsplash.com/user/r3dmax);
}

.panel4 {
  background-image: url(https://source.unsplash.com/user/nathananderson);
}

.panel5 {
  background-image: url(https://source.unsplash.com/user/aows);
}


/* Flex children */

.panel>* {
  margin: 0;
  width: 100%;
  transition: transform 0.5s;
  flex : 1 0 auto;
  display: flex;
  justify-content: center;
  align-items:center;
}

.panel> *:first-child {
  transform: translateY(-100%);
}

.panel.open-active > *:first-child {
  transform: translateY(0%);
}

.panel> *:last-child {
  transform: translateY(100%);
}

.panel.open-active> *:last-child {
  transform: translateY(0%);
}

.panel p {
  text-transform: uppercase;
  font-family: 'Amatic SC', cursive;
  text-shadow: 0 0 4px rgba(0, 0, 0, 0.75), 0 0 14px rgba(0, 0, 0, 0.75);
  font-size: 2em;
  cursor:pointer;
}

.panel p:nth-child(2) {
  font-size: 4em;
}

.panel.open {
  flex:5;
  font-size: 48px;
}

.cta {
  color: white;
  text-decoration: none;
}
            
          
!
            
              const panels = document.querySelectorAll('.panel');

function toggleOpen() {
  this.classList.toggle('open');
}

function toggleActive(e) {
  if(e.propertyName.includes('flex')) {
    this.classList.toggle('open-active');
  }
}

panels.forEach(panel => panel.addEventListener('click', toggleOpen));
panels.forEach(panel => panel.addEventListener('transitionend', toggleActive))
            
          
!
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