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 is required to process package imports. If you need a different preprocessor remove all packages first.

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

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

              
                <header>
      <div class="inner">
        <!--ハンバーガー3本線-->
        <div class="humberger-wrap">
          <div class="humberger-border-1"></div>
          <div class="humberger-border-2"></div>
          <div class="humberger-border-3"></div>
        </div>
        <!--一般的なヘッダーメニュー-->
        <nav>
          <ul class="header-navigation">
            <li class="header-navigation">
              <a href="#"><span>メニュー1</span></a>
            </li>
            <li class="header-navigation">
              <a href="#"><span>メニュー2</span></a>
            </li>
            <li class="header-navigation">
              <a href="#"><span>メニュー3</span></a>
            </li>
            <li class="header-navigation">
              <a href="#"><span>メニュー4</span></a>
            </li>
          </ul>
        </nav>
      </div>
    </header>
              
            
!

CSS

              
                * {
    box-sizing: border-box;
    margin:0;
    padding:0;
}
body {
    font-size: .9375rem;
    font-weight: 400;
    line-height: 1.67;
    overflow: hidden;
    letter-spacing: .05em;
    color: #333;
    background: #fff;
}
a {
    cursor: pointer;
    text-decoration: none;
    color: #000;
}
ol, ul {
  list-style:none;
}

/*--header--*/
header {
    font-size: 15px;
    font-size: .9375rem;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 60px;
    letter-spacing: .05em;
    background:#f1f1f1;
}

header .inner {
    display: flex;
    width: 100%;
    height: 60px;
    flex-flow: row wrap;
    justify-content: center;
}

/*ハンバーガー3本線を非表示*/
header .humberger-wrap {
  display:none;
}

header nav {
  position:relative;
}

header nav, header ul {
  display:flex;
}

header nav li {
  cursor:pointer;
}

header nav a {
  line-height:60px;
  display:block;
  height:60px;
  padding:0 30px;
}

@media screen and (max-width:901px) {


  /*3本線の表示*/
  header .humberger-wrap {
    display:block;
  }

  /*3本線の位置*/
  header .humberger-wrap {
    position: absolute;
    top: 0;
    right: 20px;
    width: 40px;
    height: 100%;
    cursor: pointer;
  }

  /*humberger-border1,2,3の線*/
  header .humberger-wrap [class*=humberger-border]  {
    position: absolute;
    width: 40px;
    height: 2px;
    transition: .4s all ease;
    transform-origin: center center;
    background: #333;
  }
  /*1本目の線*/
  header .humberger-wrap .humberger-border-1 {
    top:20px;
    right:0;
  }
  /*2本目の線*/
  header .humberger-wrap .humberger-border-2 {
    top:30px;
    right:0;
  }
  /*3本目の線*/
  header .humberger-wrap .humberger-border-3 {
    top:40px;
    right:0;
  }

  /*開閉ボタンopen時の横線1本目*/
	header .humberger-wrap.opened .humberger-border-1 {
		top: 30px;
		transform: rotate(45deg);
	}
	/*開閉ボタンopen時の横線2本目*/
	header .humberger-wrap.opened .humberger-border-2 {
    top: 30px;
		transform: rotate(-45deg);
	}
	/*開閉ボタンopen時の横線3本目*/
	header .humberger-wrap.opened .humberger-border-3 {
    top: 30px;
		transform: rotate(-45deg);
    opacity:0;
	}
  /*メニューを非表示*/
  header nav {
    display:none;
  }

  /*open時に一番上のヘッダーの背景色を変化*/
  header.opened {
    background: #fff;
  }

  header.opened nav {
    display: block;
    min-height: 100vh;
    opacity: 1;
    top:60px;
  }

  header nav ul.header-navigation {
    flex-flow: column nowrap;
  }

  header nav ul.header-navigation li a {
    display: block;
    height: auto;
    margin: 0;
    padding: 10px 0;
  }

}

@media screen and (max-width:901px) {


  /*3本線の表示*/
  header .humberger-wrap {
    display:block;
  }

  /*3本線の位置*/
  header .humberger-wrap {
    position: absolute;
    top: 0;
    right: 20px;
    width: 40px;
    height: 100%;
    cursor: pointer;
  }

  /*humberger-border1,2,3の線*/
  header .humberger-wrap [class*=humberger-border]  {
    position: absolute;
    width: 40px;
    height: 2px;
    transition: .4s all ease;
    transform-origin: center center;
    background: #333;
  }
  /*1本目の線*/
  header .humberger-wrap .humberger-border-1 {
    top:20px;
    right:0;
  }
  /*2本目の線*/
  header .humberger-wrap .humberger-border-2 {
    top:30px;
    right:0;
  }
  /*3本目の線*/
  header .humberger-wrap .humberger-border-3 {
    top:40px;
    right:0;
  }

  /*開閉ボタンopen時の横線1本目*/
	header .humberger-wrap.opened .humberger-border-1 {
		top: 30px;
		transform: rotate(45deg);
	}
	/*開閉ボタンopen時の横線2本目*/
	header .humberger-wrap.opened .humberger-border-2 {
    top: 30px;
		transform: rotate(-45deg);
	}
	/*開閉ボタンopen時の横線3本目*/
	header .humberger-wrap.opened .humberger-border-3 {
    top: 30px;
		transform: rotate(-45deg);
    opacity:0;
	}
  /*メニューを非表示*/
  header nav {
    display:none;
  }

  /*open時に一番上のヘッダーの背景色を変化*/
  header.opened {
    background: #fff;
  }

  header.opened nav {
    display: block;
    min-height: 100vh;
    opacity: 1;
    top:60px;
  }

  header nav ul.header-navigation {
    flex-flow: column nowrap;
  }

  header nav ul.header-navigation li a {
    display: block;
    height: auto;
    margin: 0;
    padding: 10px 0;
  }

}

              
            
!

JS

              
                $(function(){

	$(".humberger-wrap").on("click",function(){
		$(".humberger-wrap").toggleClass("opened");
		$("header").toggleClass("opened");
	});

	$(".header-navigation > a").on("click",function(){
		$(".humberger-wrap").removeClass("opened");
		$("header").removeClass("opened");
	})

});

              
            
!
999px

Console