cssAudio - Activefile-genericCSS - ActiveGeneric - ActiveHTML - ActiveImage - ActiveJS - ActiveSVG - ActiveText - Activefile-genericVideo - ActiveLovehtmlicon-new-collectionicon-personicon-teamlog-outoctocatpop-outspinnerstartv

Pen Settings

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.

Quick-add: + add another resource

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.

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.

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

.container#grid
  .row-helper
  .row-helper
  .column-helper
    .helper
      .wrapper
        .item
          p align-self ↕
          p justify-self ↔
    .helper
      .wrapper
        .item
          p align-self ↕
          p justify-self ↔    
  .column-helper
    .helper
      .wrapper
        .item
          p align-self ↕
          p justify-self ↔
    .helper
      .wrapper
        .item
          p align-self ↕
          p justify-self ↔
  .column-helper
    .helper
      .wrapper
        .item
          p align-self ↕
          p justify-self ↔
    .helper
      .wrapper
        .item
          p align-self ↕
          p justify-self ↔ 
            
          
!
            
              
.container {
  width: 500px;
  height: 380px;
  border: 1px solid green;
  margin: auto;
}
#grid {
  display: grid;
  grid: repeat(2, 150px) / repeat(3, 100px);
  grid-gap: 2px;
}

.grid * {
  animation-play-state: paused;
}

.item {
  background: rgba(255,160,160,.5);
  border: 1px solid rgba(255,0,0,.5);
  height: 91px;
  width: 80px;
  animation: item-align 4s ease-in-out infinite;
  p {
    margin: .5em 2px;
    transform: scale(.8);
    transform-origin: 0 50%;
    transition: transform .6s;
    cursor: pointer;
    &:hover {
      transform: none;
    }
  }
}

.wrapper {
  animation: item-justify 4s ease-in-out infinite;
}

.helper {
  background: rgba(255,255,255,.3);
  justify-self: stretch;
  align-self: stretch;
  border: 1px dashed #888;
}

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

.column-helper {
  display: grid;
  padding: 1px 0;
  grid: repeat(2, 148px) / repeat(1, 98px);
  grid-gap: 4px;
  grid-row: 1 / -1;
  grid-column: 1;
  height: 378px;
  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;
}
.column-helper + .column-helper + .column-helper {
  grid-column: 3;
  animation: col3 6s ease-in-out infinite;
}

#grid * {
  animation-play-state: paused;
}
.ac + #grid .row-helper,
.ac + #grid .helper,
.jc + #grid .column-helper,
.ai + #grid .item,
.ji + #grid .wrapper,
#grid  .helper.js .wrapper,
#grid  .helper.as .item {
  animation-play-state: running;
}

body {
  min-width: 550px;
  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(99px); }
  33% { transform: translateX(198px); }
  50% { transform: translateX(49px); }
  67% { transform: translateX(33px); }
  83% { transform: translateX(0); }
}

@keyframes col2 {
  0%, 100% { transform: translateX(0); }
  17% { transform: translateX(99px); }
  33% { transform: translateX(198px); }
  50% { transform: translateX(99px); }
  67% { transform: translateX(99px); }
  83% { transform: translateX(99px); }
}


@keyframes col3 {
  0%, 100% { transform: translateX(0); }
  17% { transform: translateX(99px); }
  33% { transform: translateX(198px); }
  50% { transform: translateX(149px); }
  67% { transform: translateX(167px); }
  83% { transform: translateX(198px); }
}

@keyframes row1 {
  0%, 100% { transform: translateY(0); }
  17% { transform: translateY(39px); }
  33% { transform: translateY(78px); }
  50% { transform: translateY(27px); }
  67% { transform: translateY(19px); }
  83% { transform: translateY(0); }
}

@keyframes row2 {
  0%, 100% { transform: translateY(0); }
  17% { transform: translateY(39px); }
  33% { transform: translateY(78px); }
  50% { transform: translateY(51px); }
  67% { transform: translateY(59px); }
  83% { transform: translateY(78px); }
}

@keyframes item-justify {
  0%, 100% { transform: translateX(0); }
  33% { transform: translateX(7px); }
  67% { transform: translateX(14px); }
}

@keyframes item-align {
  0%, 100% { transform: translateY(0); }
  33% { transform: translateY(26px); }
  67% { transform: translateY(52px); }
}
            
          
!
            
              document.querySelector('.legend').onmouseover = function(e) {
  let target = e.target;
  if (target.className == 'legend') return;
  this.className = 'legend ' + target.className;
}

document.querySelector('.legend').onmouseout = function(e) {
  this.className = 'legend';
}

document.querySelector('.container').onmouseover = function(e) {
  let target = e.target;
  if (target.parentNode.className != 'item') return;
  if (target.nextElementSibling) {
    target.closest('.helper').className = 'helper '+'as';
  }
  else {
    target.closest('.helper').className = 'helper '+'js';
  }
}

document.querySelector('.container').onmouseout = function(e) {
  let target = e.target;
  if (target.parentNode.className != 'item') return;
  target.closest('.helper').className = 'helper';
}
            
          
!
999px
Loading ..................

Console