Pen Settings



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. You can use the CSS from another Pen by using it's URL and the proper URL extention.

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


  <button class="btn-menu">メニュー</button>
      <li><a href="#">ホーム</a></li>
      <li><a href="#">サービス概要</a></li>
      <li><a href="#">実績紹介</a></li>
      <li><a href="#">お問い合わせ</a></li>


                /* 基本装飾 */
header {
  background: #333;
  padding: .5rem;
  text-align: right;
a {
  color: #fff;
  text-decoration: none;
  white-space: nowrap;
li {
  margin: 2rem 0;

/* ボタン */
.btn-menu {
  border: 1px solid #999;
  background: transparent;
  color: #fff;
  padding: .5rem 1rem;
  font-size: 1rem;
  cursor: pointer;
  line-height: 1;

/* メニュー */
nav {
  background: #0bd;
  position: absolute;
  z-index: 1;
  top: 3.125rem;
  right: 0;
  overflow-x: hidden;
  text-align: center;
  width: 0;
  transition: .5s;
/* メニューを開いた時 */ {
  width: 100%;


                const btn = document.querySelector('.btn-menu');
const nav = document.querySelector('nav');

btn.addEventListener('click', () => {
  // if (btn.innerHTML === 'メニュー') {
  //   btn.innerHTML = '閉じる';
  // } else {
  //   btn.innerHTML = 'メニュー';
  // }
  // ↑ これと同じ意味の三項演算子での書き方 ↓
  btn.innerHTML = btn.innerHTML === 'メニュー'
    ? '閉じる'
    : 'メニュー'