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 includes JSX processing.

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

Packages

Add Packages

Search for and use JavaScript packages from npm here. By selecting a package, an import statement will be added to the top of the JavaScript editor for this package.

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

              
                - var panels = ["<p>Hey</p><p>Let`s</p><p>Dance</p>", "<p>Give</p><p>Take</p><p>Receive</p>", "<p>Experience</p><p>It</p><p>Today</p>", "<p>Give</p><p>All</p><p>You can</p>", "<p>Life</p><p>In</p><p>Motion</p>"];

each panel, index in panels
  .panel(class='panel--' + (index + 1)) !{panel}

              
            
!

CSS

              
                html
  box-sizing: border-box
  background: #ffc600
  font-family: 'helvetica neue'
  font-size: 20px
  font-weight: 200

body
  display: flex
  margin: 0
  min-height: 100vh
  overflow: hidden

*,
*:before
*:after
  box-sizing: inherit

.panel
  display: flex
  flex: 1
  flex-direction: column
  align-items: center
  justify-content: center
  
  color: #fff
  font-size: 20px
  text-align: center
  
  background: #fb0f9c
  background-size: cover
  background-position: center
  box-shadow: inset 0 0 0 5px rgba(255, 255, 255, 0.1)
  
  transition:
    font-size .7s cubic-bezier(0.61, -0.19, 0.7, -0.11),
    flex .7s cubic-bezier(0.61, -0.19, 0.7, -0.11),
    background .2s
  
  > *
    display: flex
    flex: 1 0 auto
    justify-content: center
    align-items: center
    margin: 0
    width: 100%

    transition: transform .5s

  p
    font-family: 'Amatic SC', cursive
    font-size: 2rem
    text-shadow: 0 0 4px rgba(0, 0, 0, 0.72), 0 0 14px rgba(0, 0, 0, 0.45)
    text-transform: uppercase
    
    &:nth-child(2)
      font-size: 4rem

    &:first-child
      transform: translateY(-100%)
    
    &:last-child
      transform: translateY(100%)
    
  &--open-active > *
    transform: translateY(0) !important

  &--open
    flex: 5
    font-size: 40px
    
  backgrounds = 'https://wallpaperstock.net/wallpapers/thumbs1/41089wide.jpg',
                'https://www.jpl.nasa.gov/spaceimages/images/largesize/PIA07853_hires.jpg',
                'http://coachsingerslife.com/wp-content/uploads/2014/03/girl-walking.jpg',
                'https://joyenergizer.com/wp-content/uploads/2017/12/animal-balls-10.jpg',
                'https://c1.staticflickr.com/5/4250/35431825255_f2e4e1fc6b_b.jpg'
    
  for bkg, index in backgrounds
    &--{index + 1}
      background-image: s("url(%s)" % bkg)

              
            
!

JS

              
                const panels = document.querySelectorAll('.panel');

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

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

panels.forEach(p => p.addEventListener('click', toggleOpen));
panels.forEach(p => p.addEventListener('transitionend', toggleActive));

              
            
!
999px

Console