Pen Settings



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


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


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.


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.


  .text Probier uns aus!
        %th Ausrichtung:
        %td{colspan: 2}
          %input{type: 'radio', name: 'direction', onclick: 'updateDemo();', value: 'justify', checked: true}
          %label{for: 'justify'} horizontal (justify)
        %td{colspan: 2}
          %input{type: 'radio', name: 'direction', onclick: 'updateDemo();', value: 'align'}
          %label{for: 'align'} vertikal (align)
        %td{colspan: 2}
          %input{type: 'radio', name: 'direction', onclick: 'updateDemo();', value: 'place'}
          %label{for: 'place'} beides (place)
        %th Ziel:
        %td{colspan: 2}
          %input{type: 'radio', name: 'target', onclick: 'updateDemo();', value: 'content', checked: true}
          %label{for: 'content'} komplette Grid (content)
        %td{colspan: 2}
          %input{type: 'radio', name: 'target', onclick: 'updateDemo();', value: 'items'}
          %label{for: 'items'} alle Grid-Items (items)
        %td{colspan: 2}
          %input{type: 'radio', name: 'target', onclick: 'updateDemo();', value: 'self'}
          %label{for: 'self'} einzelnes Grid-Item (self)
        %th Wert:
          %input{type: 'radio', name: 'value', onclick: 'updateDemo();', checked: true, value: 'start'}
          %label.underline{for: 'start'} start
          %input{type: 'radio', name: 'value', onclick: 'updateDemo();', value: 'end'}
          %label{for: 'end'} end
          %input{type: 'radio', name: 'value', onclick: 'updateDemo();', value: 'center'}
          %label{for: 'center'} center
          %input{type: 'radio', name: 'value', onclick: 'updateDemo();', value: 'stretch'}
          %label{for: 'stretch'} stretch
          %input{type: 'radio', name: 'value', onclick: 'updateDemo();', value: 'space-around'}
          %label{for: 'space-around'} space-around
          %input{type: 'radio', name: 'value', onclick: 'updateDemo();', value: 'space-between'}
          %label{for: 'space-between'} space-between
          %input{type: 'radio', name: 'value', onclick: 'updateDemo();', value: 'space-evenly'}
          %label{for: 'space-evenly'} space-evenly



                .container {
  background-color: #cedafe;
  border-radius: 5px;
  margin-bottom: 2em;
  display: grid;
  grid-template-columns: repeat(3, 50px);
  grid-template-rows: repeat(3, 50px);
  grid-gap: 20px;
  height: 260px; // Höher als nötig, um *-content darzustellen
  width: 260px; // Breiter als nötig, um *-content darzustellen

.item {
  background-color: lightgreen;
  border: 2px solid green;
  border-radius: 5px;
  padding: 15px;

.self {
  background-color: khaki;
  border-color: darkorange;

// Setup/Controls

body {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-direction: column;
  min-height: 100vh;
  margin: 0;
  font-family: Helvetica, Arial, Verdana, sans-serif;
  font-size: .9em;

.controls {
  text-align: center;
  margin-top: 0.5em;
  width: 100%;
  input {
    display: block;
    margin: 0 auto 5px;
  label {
    display: inline-block;
  table {
    margin: 0 auto;
    th {
      text-align: left;
    td {
      text-align: center;
    th, td {
      padding: 0.3em;

.disabled {
  color: lightgrey;

.underline {
  text-decoration: underline;


                $ ->
  $container = $(".container")
  $self = $(".self")

  window.updateDemo = ->
    target = getCurrentState()[0]
    property = getCurrentState()[1] + '-' + target
    value = getCurrentState()[2]


    if target is 'self'
      $self.css(property, value)
      $container.css(property, value)

  # Aktuell ausgewählten Werte ermitteln
  window.getCurrentState = ->
    return [$("input:radio[name='target']:checked").val(),

  # Komplette Grid hat mehr Eigenschaften als die Items und hat einen anderen Default-Wert
  window.handleDifferingOptions = (target) ->
    $start = $("label[for='start'")
    $stretch = $("label[for='stretch'")

    if target is 'content'
      $("input:radio[value^='space-']").attr('disabled', false)
      $("input:radio[value^='space-']").attr('disabled', true)
      # Falls ein deaktivierter Button angewählt ist, dann auf stretch ausweichen
      if $("input[name='value']:checked").val().indexOf("space-") >= 0
        $("#stretch").prop("checked", true)
  # Alles resetten in den Ursprungszustand
  window.resetContainer = ->
    $container.css('justify-content', '')
    $container.css('align-content', '')
    $container.css('place-content', '')
    $container.css('justify-items', '')
    $container.css('align-items', '')
    $container.css('place-items', '')
    $self.css('justify-self', '')
    $self.css('align-self', '')
    $self.css('place-self', '')