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

+ 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

              
                <header>
  <div class="inner">
    <p class="logo"><a class="over" href="#">COMPANY</a></p>
    <ul class="navi">
      <li><a href="/feature/">選ばれる理由</a></li>
      <li><a href="/service/">サービス</a></li>
      <li><a href="/case/">制作事例</a></li>
      <li><a href="/company/">会社案内</a></li>
      <li><a href="/recruit/">採用情報</a></li>
    </ul>
  </div>
  <button class="sp-navi-toggle"><span class="bar"></span><span class="bar"></span><span class="bar"></span><span class="menu">MENU</span><span class="close">CLOSE</span></button>
</header>


    
              
            
!

CSS

              
                /* header */

header {
  position: fixed;
  z-index: 999;
  top: 0;
  left: 0;
  width: 100%;
  padding: 20px 0;
  background: #eee;
}
header .inner {
  position: relative;
  padding: 0 20px;
  display: flex;
  align-items: center;
  height: 100%;
}
/* .logo */

header .logo {
  position: relative;
  width: 100px;
  margin: 0;
  padding: 0;
}
header .logo a {
  font-weight: bold;
  text-decoration: none;
  color: #333;
}

@media screen and (max-width: 767px) {
  header .logo {
    padding: 0;
  }
  header .logo a {
  }
}

/* scroll */

header {
  transition: height 0.4s cubic-bezier(0.34, 0.615, 0.4, 0.985);
}
header.scroll {
  height: 60px;
  position: fixed;
  z-index: 9999;
  box-shadow: 0 0 10px rgba(0, 0, 0, 0.1);
}
header .logo {
  transition: width 0.4s cubic-bezier(0.34, 0.615, 0.4, 0.985);
}
header.scroll .logo {
  width: 70px;
}

/* header-navi-box */

header .navi {
  margin: 0 0 0 auto;
  padding: 0;
  font-size: 14px;
  font-weight: bold;
  display: flex;
  list-style: none;
}
header .navi li {
  margin: 5px 0 5px 40px;
}
header .navi li:first-child {
  margin-left: 0;
}
header .navi li a {
  display: block;
  box-sizing: border-box;
  text-decoration: none;
  color: #333;
}
header .navi li a:hover {
  text-decoration: underline;
}

@media screen and (max-width: 767px) {
  header .navi {
    display: none;
  }
}

/* open-button */

.sp-navi-toggle {
  display: none;
  margin: auto 0;
  font-size: 10px;
  font-weight: bold;
  line-height: 1;
  position: absolute;
  top: 0;
  bottom: 0;
  right: 40px;
  width: 16px;
  height: 25px;
  transition: all 0.4s;
  color: #464646;
  border: none;
  outline: none;
  background: none;
  -webkit-appearance: unset;
}
.sp-navi-toggle .menu,
.sp-navi-toggle .close {
  position: absolute;
  bottom: 0;
  left: -50%;
  display: block;
  width: 34px;
  height: 11px;
}
.sp-navi-toggle .close {
  display: none;
}
.sp-navi-toggle .bar {
  position: absolute;
  left: 0;
  width: 100%;
  height: 2px;
  background-color: #464646;
}
.sp-navi-toggle .bar:nth-of-type(1) {
  top: 0;
}
.sp-navi-toggle .bar:nth-of-type(2) {
  top: 5px;
}
.sp-navi-toggle .bar:nth-of-type(3) {
  top: 10px;
}

/* close-button */

html.sidebar-is-open .sp-navi-toggle .bar:nth-of-type(1) {
  top: 5px;
  transform: rotate(45deg);
}
html.sidebar-is-open .sp-navi-toggle .bar:nth-of-type(2) {
  top: 5px;
  transform: rotate(-45deg);
}
html.sidebar-is-open .sp-navi-toggle .bar:nth-of-type(3) {
  display: none;
}
html.sidebar-is-open .sp-navi-toggle .menu {
  display: none;
}
html.sidebar-is-open .sp-navi-toggle .close {
  display: block;
}

@media screen and (max-width: 767px) {
  .sp-navi-toggle{
    display: block;
  }
}

/* sp-navi */

.sp-navi-box {
  display: none;
}
.sp-navi {
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  list-style: none;
  width: 100%;
  height: 100vh;
  font-size: 14px;
  margin: 0;
  padding: 0;
}
.sp-navi li {
  padding: 20px 0;
}
.sp-navi li a {
  display: block;
  box-sizing: border-box;
  text-decoration: none;
  color: #333;
  font-weight: bold;
}
.sp-navi li a:hover {
  text-decoration: underline;
}




@media screen and (max-width: 767px) {
  html.sidebar-is-open .sp-navi-box {
    display: block;
  }
  html.sidebar-is-open {
    position: fixed;
    top: 0;
    right: 0;
    bottom: 0;
    left: 0;
    overflow: hidden;
    width: 100%;
  }
}

body {
  margin: 0;
  padding: 0;
}

              
            
!

JS

              
                //sp menu

(function () {
  document
    .querySelector("body")
    .insertAdjacentHTML("afterbegin", '<div class="sp-navi-box"><div class="sp-navi"></div></div>');
  document.querySelector(".sp-navi").innerHTML = document.querySelector(
    ".navi"
  ).innerHTML;

  const documentElement = document.querySelector("html");
  const contentElement = document.querySelector("#main");
  const sidebarElement = document.querySelector(".sp-navi-box");
  const openSidebar = function () {
    scl_point = window.pageYOffset;
    documentElement.classList.add("sidebar-is-open");
    $("body").css("top", "-" + scl_point + "px");
  };
  const closeSidebar = function () {
    documentElement.classList.remove("sidebar-is-open");
    $(window).scrollTop(
      $("body").css("top").replace(/-/g, "").replace(/px/g, "")
    );
    $("body").css("top", 0);
  };
  $(".sp-navi-toggle").click(function () {
    //, .sp-navi-box a[href^=#]
    if ($(".sidebar-is-open").length) {
      closeSidebar();
    } else {
      openSidebar();
    }
  });
})();

              
            
!
999px

Console