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

              
                <header class="header">
  <div class="menu">
    <!-- 親メニューリスト -->
    <ul class="menu__list">
      <!-- 親メニューA -->
      <li class="menu__item">
        <a href="#">MenuA</a>
      </li>
      <!-- 親メニューB -->
      <li class="menu__item">
        <a href="#">MenuB</a>
      </li>
      <!-- 親メニューC -->
      <li class="menu__item">
        <a href="#">MenuC</a>
      </li>
      <!-- 親メニューD -->
      <li class="menu__item">
        <a href="#">MenuD</a>
      </li>
    </ul>
  </div>
</header>
              
            
!

CSS

              
                /* 今回追加した内容 */
/* メニュー内のすべてのulタグ */
.menu ul {
  list-style-type: none; /* 先頭の中点無し */
  /* ブラウザによる余分な余白を無くす */
  margin: 0;
  padding: 0; 
}
/* 親メニューリスト */
.menu__list {
  display: flex; /* 親メニューは横並び */
}
/* 親項目 */
.menu__item {
  /* 子メニューの位置の基準になるようにrelative */
  position: relative;
  width: 25%; /* メニュー4個なので4等分 */
  line-height: 60px;
  text-align: center; /* 文字を中央寄せ */
}
/* 親メニューマウスホバー時 */
.menu__item:hover {
  /* 背景色を変えて選択状態をわかりやすくする */
  background: DeepSkyBlue;
}
/* メニュー内のすべてのaタグ */
.menu a {
  /* aタグを親要素いっぱいに広げるためにflex */
  display: flex;
  justify-content: center; /* 水平方向中央寄せ */
  align-items: center; /* 垂直方法中央寄せ */
  height: 100%;
  
  color: white;
  text-decoration: none; /* リンクの下線は非表示 */
}
/* 訪問済みのリンク */
menu a:visited {
  /* ブラウザによる訪問済リンクの色の変更を抑制 */
  color: white;
}

/* 以前からの内容 */
.header {
  width: 100%;
  height: 60px;
  background: lightgray;
}
.menu {
  width: 80%;
  max-width: 1280px;
  height: 100%;
  margin: 0 auto;
  background: DodgerBlue;
}
              
            
!

JS

              
                
              
            
!
999px

Console