Pen Settings

HTML

CSS

CSS Base

Vendor Prefixing

Add External Stylesheets/Pens

Any URLs added here will be added as <link>s in order, and before the CSS in the editor. You can use the CSS from another Pen by using its URL and the proper URL extension.

+ 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

Auto Save

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

              
                .panel
  h2 flex-direction: row ↔
  .legend
    p.ac align-content ↕
    p.jc justify-content ↔
    p.ai align-items ↕
    p.ji.inactive justify-items ↔

  .container#row

    .row-helper
      .helper
        .item
          p align-self ↕
          p.inactive justify-self ↔
      .helper
        .item
          p align-self ↕
          p.inactive justify-self  ↔
      .helper
        .item
          p align-self ↕
          p.inactive justify-self ↔
    .row-helper
      .helper
        .item
          p align-self ↕
          p.inactive justify-self ↔
      .helper
        .item
          p align-self ↕
          p.inactive justify-self ↔

.panel
  h2 flex-direction: column ↕

  .legend
    p.ac align-content ↔
    p.jc justify-content ↕
    p.ai align-items ↔
    p.ji.inactive justify-items ↕

  .container#column

    .column-helper
      .helper
        .item
          p align-self ↔
          p.inactive justify-self ↕
      .helper
        .item
          p align-self ↔
          p.inactive justify-self  ↕
      .helper 
        .item
          p align-self ↔
          p.inactive justify-self  ↕   
    .column-helper
      .helper
        .item
          p align-self ↔
          p.inactive justify-self ↕
      .helper
        .item
          p align-self ↔
          p.inactive justify-self ↕
              
            
!

CSS

              
                panel:first-child {
  margin-right: 20px;
  width: 350px;
}

.container {
  width: 300px;
  height: 300px;
  border: 1px solid green;
}
#column, #row {
  display: grid;
  grid: repeat(2, 100px) / repeat(3, 100px);
  grid-gap: 2px;
}

#column *, #row * {
  animation-play-state: paused;
}

#row .helper + .helper {
  margin-left: 2px;
}
.row-helper:first-child .helper:nth-child(1) { animation: row-item1 6s ease-in-out infinite; }
.row-helper:first-child .helper:nth-child(2) { animation: row-item2 6s ease-in-out infinite; }
.row-helper:first-child .helper:nth-child(3) { animation: row-item3 6s ease-in-out infinite; }
.row-helper:last-child .helper:nth-child(1) { animation: row-item4 6s ease-in-out infinite; }
.row-helper:last-child .helper:nth-child(2) { animation: row-item5 6s ease-in-out infinite; }


#column .helper + .helper {
  margin-top: 2px;
}
.column-helper:first-child .helper:nth-child(1) { animation: col-item1 6s ease-in-out infinite; }
.column-helper:first-child .helper:nth-child(2) { animation: col-item2 6s ease-in-out infinite; }
.column-helper:first-child .helper:nth-child(3) { animation: col-item3 6s ease-in-out infinite; }
.column-helper:last-child .helper:nth-child(1) { animation: col-item4 6s ease-in-out infinite; }
.column-helper:last-child .helper:nth-child(2) { animation: col-item5 6s ease-in-out infinite; }

.item {
  background: rgba(255,160,160,.5);
  border: 1px solid rgba(255,0,0,.5);
  height: 80px;
  width: 80px;
  .row-helper & {
    animation: item-align-r 4s ease-in-out infinite;
  }
  .column-helper & {
    animation: item-align-c 4s ease-in-out infinite;
  }
  .helper:nth-last-child(2) & {
    height: 96px;
    width: 96px;
    animation: none;
  }
  .row-helper:first-child :first-child & {
    width: 90px;
  }
  .column-helper:first-child :first-child & {
    height: 90px;
  }
  p {
    margin: .5em 2px;
    transform: scale(.8);
    transform-origin: 0 50%;
    transition: transform .6s;
    cursor: pointer;
    &:hover {
      transform: none;
    }
  }
  #column & + & {
    margin-top: 2px;
  }
  #row & + & {
    margin-left: 2px;
  }
}

.row-helper {
  display: flex;
  grid-column: 1 / -1;
  grid-row: 1;
  width: 300px;
  background: rgba(0,255,0,.2) 50%;
  border: dashed rgba(0,255,0,.5);
  border-width: 1px 0;
  animation: row1 6s ease-in-out infinite;
}
.row-helper + .row-helper {
  grid-row: 2;
  animation: row2 6s ease-in-out infinite;
}

.column-helper {
  display: flex;
  flex-flow: column;
  height: 300px;
  background: rgba(0,0,255,.2);
  border: dashed rgba(0,0,255,.5);
  border-width: 0 1px;
  animation: col1 6s ease-in-out infinite;
}
.column-helper + .column-helper {
  grid-column: 2;
  animation: col2 6s ease-in-out infinite;
}

.jc + .container:not(#false) .helper,
.ac + #row .row-helper,
.ac + #column .column-helper,
.ai + #row .item,
.ai + #column .item,
#row .as .item,
#column .as .item
{
  animation-play-state: running;
}

body {
  display: flex;
  flex-flow: row wrap;
  justify-content: space-evenly;
  font: 15px/1 sans-serif;
}

.legend {
  display: grid;
  grid: repeat(2, auto) / repeat(2, 170px);
  width: 340px;
  grid-auto-flow: column;
  margin: 0 auto 1em;
  font-size: 20px;
  
  p {
    margin: .5em;
    transform: scale(.8);
    transform-origin: 0 50%;
    transition: transform .6s;
    cursor: pointer;
  }
}
.ac .ac,
.jc .jc,
.ai .ai,
.ji .ji {
  transform: none;
}

@keyframes col1 {
  0%, 100% { transform: translateX(0); }
  17% { transform: translateX(49px); }
  33% { transform: translateX(98px); }
  50% { transform: translateX(33px); }
  67% { transform: translateX(23px); }
  83% { transform: translateX(0); }
}

@keyframes col2 {
  0%, 100% { transform: translateX(0); }
  17% { transform: translateX(49px); }
  33% { transform: translateX(98px); }
  50% { transform: translateX(65px); }
  67% { transform: translateX(75px); }
  83% { transform: translateX(98px); }
}

@keyframes row1 {
  0%, 100% { transform: translateY(0); }
  17% { transform: translateY(49px); }
  33% { transform: translateY(98px); }
  50% { transform: translateY(33px); }
  67% { transform: translateY(23px); }
  83% { transform: translateY(0); }
}

@keyframes row2 {
  0%, 100% { transform: translateY(0); }
  17% { transform: translateY(49px); }
  33% { transform: translateY(98px); }
  50% { transform: translateY(65px); }
  67% { transform: translateY(75px); }
  83% { transform: translateY(98px); }
}

@keyframes item-align-c {
  0%, 100% { transform: translateX(0); }
  33% { transform: translateX(8px); }
  67% { transform: translateX(17px); }
}

@keyframes item-align-r {
  0%, 100% { transform: translateY(0); }
  33% { transform: translateY(8px); }
  67% { transform: translateY(17px); }
}

@keyframes row-item1 {
  0%, 100% { transform: translateX(0); }
  17% { transform: translateX(12px); }
  33% { transform: translateX(24px); }
  50% { transform: translateX(8px); }
  67% { transform: translateX(6px); }
  83% { transform: translateX(0); }
}
@keyframes row-item2 {
  0%, 100% { transform: translateX(0); }
  17% { transform: translateX(12px); }
  33% { transform: translateX(24px); }
  50% { transform: translateX(12px); }
  67% { transform: translateX(12px); }
  83% { transform: translateX(12px); }
}
@keyframes row-item3 {
  0%, 100% { transform: translateX(0); }
  17% { transform: translateX(12px); }
  33% { transform: translateX(24px); }
  50% { transform: translateX(16px); }
  67% { transform: translateX(18px); }
  83% { transform: translateX(24px); }
}
@keyframes row-item4 {
  0%, 100% { transform: translateX(0); }
  17% { transform: translateX(59px); }
  33% { transform: translateX(118px); }
  50% { transform: translateX(39px); }
  67% { transform: translateX(29px); }
  83% { transform: translateX(0); }
}
@keyframes row-item5 {
  0%, 100% { transform: translateX(0); }
  17% { transform: translateX(59px); }
  33% { transform: translateX(118px); }
  50% { transform: translateX(79px); }
  67% { transform: translateX(89px); }
  83% { transform: translateX(118px); }
}


@keyframes col-item1 {
  0%, 100% { transform: translateY(0); }
  17% { transform: translateY(12px); }
  33% { transform: translateY(24px); }
  50% { transform: translateY(8px); }
  67% { transform: translateY(6px); }
  83% { transform: translateY(0); }
}
@keyframes col-item2 {
  0%, 100% { transform: translateY(0); }
  17% { transform: translateY(12px); }
  33% { transform: translateY(24px); }
  50% { transform: translateY(12px); }
  67% { transform: translateY(12px); }
  83% { transform: translateY(12px); }
}
@keyframes col-item3 {
  0%, 100% { transform: translateY(0); }
  17% { transform: translateY(12px); }
  33% { transform: translateY(24px); }
  50% { transform: translateY(16px); }
  67% { transform: translateY(18px); }
  83% { transform: translateY(24px); }
}
@keyframes col-item4 {
  0%, 100% { transform: translateY(0); }
  17% { transform: translateY(59px); }
  33% { transform: translateY(118px); }
  50% { transform: translateY(39px); }
  67% { transform: translateY(29px); }
  83% { transform: translateY(0); }
}
@keyframes col-item5 {
  0%, 100% { transform: translateY(0); }
  17% { transform: translateY(59px); }
  33% { transform: translateY(118px); }
  50% { transform: translateY(79px); }
  67% { transform: translateY(89px); }
  83% { transform: translateY(118px); }
}

p.inactive  {
  color: rgba(0,0,0,.3);
}
              
            
!

JS

              
                
document.querySelectorAll('.legend').forEach(elem => elem.onmouseover = function(e) {
  let target = e.target;
  if (target.className == 'legend') return;
  this.className = 'legend ' + target.className;
});

document.querySelectorAll('.legend').forEach(elem => elem.onmouseout = function(e) {
  this.className = 'legend';
});

document.querySelectorAll('.container').forEach(elem => elem.onmouseover = function(e) {
  let target = e.target;
  if (target.parentNode.className != 'item') return;
  if (target.nextElementSibling) {
    target.closest('.helper').className = 'helper as';
  }
});

document.querySelectorAll('.container').forEach(elem => elem.onmouseout = function(e) {
  let target = e.target;
  if (target.parentNode.className != 'item') return;
  target.closest('.helper').className = 'helper';
});

              
            
!
999px

Console