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.

            
              .panel
  fieldset
    legend justify-content
    select(name='jc')
      each val in ['stretch', 'start', 'end', 'flex-start', 'flex-end', 'left', 'right', 'center', 'space-between', 'space-around', 'space-evenly']
        option(value=''+val)
          =val
  fieldset
    legend align-content
    select(name='ac')
      each val in ['stretch', 'start', 'end', 'flex-start', 'flex-end', 'left', 'right', 'center', 'space-between', 'space-around', 'space-evenly']
        option(value=''+val)
          =val

.container#grid
  each val in ['Раз контент', 'Два контент', 'Три контент', 'Четыре контент', 'Контент справа налево','Еще контент']
    .item
      =val
    .helper
            
          
!
            
              
.container {
  width: 500px;
  height: 380px;
  border: 1px solid green;
}
#grid {
  display: grid;
  grid: repeat(2, auto) / repeat(3, auto);
}
#flex {
  display: flex;
  flex-flow: row wrap;
}
.item {
  background: rgba(255,160,160,.5);
  border: 1px solid rgba(255,0,0,.5);
}
#flex .item:nth-child(5), #grid .item:nth-child(9) {
  direction: rtl;
  background: rgba(160,255,160,.5);
  border: 1px solid rgba(0,255,0,.5);
}
.tb {
  writing-mode: tb-rl;
}
.helper {
  background: #ccc;
  justify-self: stretch;
  align-self: stretch;
  border: 1px solid #888;
  z-index: -1;
}
@for $i from 0 through 1 {
  @for $j from 0 through 2 {
    .item:nth-child(#{($i * 3 + $j) * 2 + 1}), .helper:nth-child(#{($i * 3 + $j) * 2 + 2}) {
      grid-row: #{$i + 1};
      grid-column: #{$j + 1};
    }
  }
}

.panel {
  display: flex;
  margin-bottom: 1em;
  justify-content: space-between;
}
ul {
  list-style: none;
  padding: 0;
}
body {
  width: 550px;
}
            
          
!
            
              const properties = {
  jc: 'justify-content',
  ac: 'align-content',
  ji: 'justify-items',
  ai: 'align-items',
  js: 'justify-self',
  as: 'align-self'
}

for (let key in properties) {
  let controls = document.getElementsByName(key);

  controls.forEach(function(item) {
    if (key === 'as' || key === 'js' ) {
      item.addEventListener('change', event=>{
        console.log(event.target.parentNode.parentNode)
        event.target.parentNode.parentNode.style.setProperty(properties[key],event.target.value);
      });
    }
    else {
      item.addEventListener('change', event=>{
        document.getElementById('grid').style.setProperty(properties[key],event.target.value);
        document.getElementById('flex').style.setProperty(properties[key],event.target.value);
      })
    }
  });
}
            
          
!
999px
Loading ..................

Console