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

Auto Save

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

              
                <div class="menu-area">
  <h2>リスト(階層あり)のレイアウト例</h2>
  <ol class="menu1">
    <li>一階層①</li>
    <li>一階層②
      <ul class="menu2">
        <li>二階層①</li>
        <li>二階層②
          <ul class="menu3">
            <li>三階層①</li>
            <li>三階層②</li>
          </ul>
        </li>
        <li>二階層③</li>
      </ul>
    </li>
    <li>一階層③</li>
  </ol>
</div>
              
            
!

CSS

              
                /* 共通 */
:root {
  --list-color: #3261ab;
}

ol, ul {
  /* リストスタイルなし */
  list-style: none;
  /* フォントサイズを揃える */
  font-size: 16px;
  /* パディングなし */
  padding: 0;
}

ol li, ul li {
  /* リストの間隔 */
  margin: 8px 0;
}

/* リストの表示エリア */
.menu-area {
  margin: 0 auto;
  width: 400px;
}

/* ↓↓↓ ここから下がリスト用 ↓↓↓ */
/* 一階層 */
ol.menu1 {
  counter-reset: count;
}

ol.menu1 > li {
  position: relative;
  /* インデント */
  padding-left: 24px;
}

ol.menu1 > li::before {
  /* コンテンツ(番号) */
  content: counter(count);
  counter-increment: count 1;
  /* インラインブロック */
  display: inline-block;
  position: absolute;
  /* 位置 */
  left: 0px;
  top: 2px;
  /* 背景 */
  background-color: var(--list-color);
  border-radius: 50%;
  /* 文字 */
  font-size: 14px;
  text-align: center;
  color: #fff;
}

/* 二階層 */
ul.menu2 > li {
  position: relative;
  /* インデント */
  padding-left: 18px;
}

ul.menu2 > li::before {
  /* コンテンツ(FontAwesome) */
  font-family: 'FontAwesome';
  content: '\f138';
  /* インラインブロック */
  display: inline-block;
  position: absolute;
  /* 位置 */
  left: -3px;
  top: 2px;
  /* 文字 */
  font-size: 16px;
  text-align: center;
  color: var(--list-color);
}

/* 三階層 */
ul.menu3 > li {
  position: relative;
  /* インデント */
  padding-left: 18px;
}

ul.menu3 > li::before {
  /* コンテンツ(FontAwesome) */
  font-family: 'FontAwesome';
  content: '\f054';
  /* インラインブロック */
  display: inline-block;
  position: absolute;
  /* 位置 */
  left: -3px;
  top: 2px;
  /* 文字 */
  font-size: 12px;
  text-align: center;
  color: var(--list-color);
}

/* リストの先頭部分のサイズ */
ol.menu1 > li::before,
ul.menu2 > li::before,
ul.menu3 > li::before {
  /* サイズ */
  width: 20px;
  height: 20px;
  line-height: 20px;
}
              
            
!

JS

              
                
              
            
!
999px

Console