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

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

              
                .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
              
            
!

CSS

              
                
.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;
}
              
            
!

JS

              
                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

Console