Pen Settings

HTML

CSS

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.

+ 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

              
                // data
-
  var items = [
    {
      text: 'リスト大項目',
      childItems: [
        {
          text: 'リスト中項目'
        },
        {
          text: 'リスト中項目'
        },
        {
          text: 'リスト中項目',
          grandChildItems: [
            {
              text: 'リスト小項目'
            },
            {
              text: 'リスト小項目',
              superGrandChildItems: [
                {
                  text: 'リスト最小項目'
                },
                {
                  text: 'リスト最小項目'
                }
              ]
            }
          ]
        }
      ]
    },
    {
      text: 'リスト大項目'
    },
    {
      text: 'リスト大項目',
      childItems: [
        {
          text: 'リスト中項目',
          grandChildItems: [
            {
              text: 'リスト小項目'
            }
          ]
        },
        {
          text: 'リスト中項目'
        }
      ]
    },
    {
      text: 'リスト大項目'
    }
  ];

// template
ol.nest-0
  each item in items
    li 
      if item.childItems
        span #{item.text}
        ol.nest-1
          each childItem in item.childItems
            li
              if childItem.grandChildItems
                span #{childItem.text}
                ol.nest-2
                  each grandChildItem in childItem.grandChildItems
                    li
                      if grandChildItem.superGrandChildItems
                        span #{grandChildItem.text}
                        ol.nest-3
                          each superGrandChildItem in grandChildItem.superGrandChildItems
                            li
                              span #{superGrandChildItem.text}
                      else
                        span #{grandChildItem.text}
              else
                span #{childItem.text}
      else
        span #{item.text}
              
            
!

CSS

              
                // 入れ子リストの数
$nested: 3

ol
  margin: 0 0 0 -3em
  li
    margin: 20px 0 0 0
    padding: 0 0 0 6em
    position: relative
    &::before 
      position: absolute
      left: 0
      top: 0
      width: 6em
      text-align: right
  @for $index from 0 through $nested
    &.nest-#{$index} > li
      counter-increment: nest-#{$index}
      &::before
        @if $index == 0
          // 親要素のリスト項目
          content: counter(nest-#{$index})':'
        @else
          $prefix: counter(nest-#{$index - 1})'-'
          @if $index == 1
            // 子要素のリスト項目
            content: $prefix counter(nest-#{$index})':'
          @else
            @for $count from $nested - 1 through $index
              $prefix: join(counter(nest-#{$index - $count})'-', $prefix)
            // 孫要素以下のリスト項目
            content: $prefix counter(nest-#{$index})':'
              
            
!

JS

              
                
              
            
!
999px

Console