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

              
                <nav>
    <div class="navbar">
      <div class='menu-btn' role="button">
        <div class="line"></div>
        <div class="line"></div>
        <div class="line"></div>
      </div>
      <div class="logo"><a href="https://html-plus.in.ua/" target="_blank">HTML+</a></div>
      <div class="nav-links">
        <div class="sidebar-menu">
          <span class="menu-name">
            <img src="https://html-plus.in.ua/wp-content/uploads/2018/10/logo.png" alt="Logo">
          </span>
          <span class='close-menu' role="button">&times;</span>
        </div>
        <ul class="links">
          <li><a href="https://html-plus.in.ua/">Главная</a></li>
          <li>
            <a href="https://html-plus.in.ua/html">HTML/CSS</a>
            <i class='arrow'></i>
            <ul class="sub-menu">
              <li><a href="https://html-plus.in.ua/category/html/bazovyy-html/">Базовый HTML</a></li>
              <li><a href="https://html-plus.in.ua/category/html/formy/">Формы</a></li>
              <li><a href="https://html-plus.in.ua/category/html/instrumenty-razrabotchika/">Инструменты разработчика</a></li>
              <li>
               <a href="#">CSS</a>
               <i class='arrow'></i>        
                <ul class="sub-menu">
                  <li><a href="https://html-plus.in.ua/category/menyu/">Меню</a></li>
                  <li><a href="https://html-plus.in.ua/category/css/css-animaciya/">CSS-анимация</a></li>
                  <li><a href="https://html-plus.in.ua/category/bootstrap/">Bootstrap</a></li>
                </ul>
              </li>
            </ul>
          </li>
          <li>
            <a href="https://html-plus.in.ua/category/javascript/">JavaScript</a>
            <i class='arrow'></i>
            <ul class="sub-menu">
              <li><a href="https://html-plus.in.ua/category/javascript/obrabotka-sobytiy/">Обработка событий</a></li>
              <li><a href="https://html-plus.in.ua/category/javascript/objects-classes/">Объекты, классы</a></li>
              <li><a href="https://html-plus.in.ua/category/javascript/es6/">ES6</a></li>
              <li><a href="https://html-plus.in.ua/category/jquery/">jQuery</a></li>
            </ul>
          </li>
          <li><a href="https://html-plus.in.ua/category/wordpress/">Wordpress</a></li>
          <li><a href="https://html-plus.in.ua/contacts/">Контакты</a></li>
        </ul>
      </div>
  
    </div>
  </nav>
              
            
!

CSS

              
                *{
  margin: 0;
  padding: 0;
  box-sizing: border-box;
  font-family: 'Montserrat', sans-serif;
}
body{
  min-height: 100vh;
}
nav{
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  height: 70px;
  background: #1E8CBE;
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.2);
  z-index: 99;
}
nav .navbar{
  height: 100%;
  max-width: 1250px;
  width: 100%;
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin: auto;
  /* background: red; */
  padding: 0 50px;
}
nav .logo a{
  font-size: 30px;
  color: #fff;
  text-decoration: none;
  font-weight: 600;
}
nav .nav-links{
  line-height: 70px;
  height: 100%;
}
nav .links{
  display: flex;
}
nav .links li{
  position: relative;
  display: flex;
  align-items: center;
  justify-content: space-between;
  list-style: none;
  padding: 0 14px;
}
nav .links li a{
  height: 100%;
  text-decoration: none;
  white-space: nowrap;
  color: #fff;
  font-size: 15px;
  font-weight: 500;
}
.links li:hover > .arrow{
  transform: rotate(180deg);
 }

nav .links li .arrow{
  background: url("data:image/svg+xml,%3C%3Fxml version='1.0' encoding='utf-8'%3F%3E%3Csvg viewBox='0 0 500 500' fill='white' xmlns='http://www.w3.org/2000/svg'%3E%3Cpath d='M 175.03 339.653 C 187.53 352.153 207.83 352.153 220.33 339.653 L 343.633 167.421 C 356.133 154.921 356.133 134.621 343.633 122.121 C 331.133 109.621 310.833 109.621 298.333 122.121 L 197.63 271.753 L 98.456 120.691 C 85.956 108.191 65.656 108.191 53.156 120.691 C 40.656 133.191 40.656 153.491 53.156 165.991 L 174.93 339.753 L 175.03 339.653 Z'/%3E%3C/svg%3E") no-repeat center/contain;
  height: 18px;
  width: 14px;
  line-height: 18px;
  text-align: center;
  display: inline-block;
  vertical-align: middle;
  color: #fff;
  margin-left: 4px;
  transition: all 0.3s ease;
}
nav .links li .sub-menu{
  position: absolute;
  top: 70px;
  left: 0;
  line-height: 40px;
  background: #1E8CBE;
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.2);
  border-radius: 0 0 4px 4px;
  display: none;
  z-index: 2;
}
@media (min-width: 800.98px){
  nav .links li:hover > .sub-menu{
    display: block;
  }
  .links li .sub-menu li:hover .sub-menu{
    display: block;
  }
}
nav .links li .sub-menu li{
  padding: 0 8px;
  border-bottom: 1px solid rgba(255,255,255,0.1);
}
nav .links li .sub-menu a {
  color: #fff;
  font-size: 15px;
  font-weight: 500;
}
nav .links li .sub-menu .arrow{
  transform: rotate(-90deg);
  margin-top: -2px;
}

nav .links li .sub-menu .sub-menu{
  position: absolute;
  top: 0;
  left: 100%;
  border-radius: 0 4px 4px 4px;
  z-index: 1;
  display: none;
}
nav .sidebar-menu{
  display: none;
}
nav .close-menu {
  font-size: 30px;
  font-weight: bold; 
  color: #fff;
  cursor: pointer;
  margin-top: -10px;
}
.menu-btn {
  display: none;
  width: 24px;
  height: 23px;
  cursor: pointer;
  margin-top: 5px;
}
.menu-btn .line {
  background-color: #fff;
  height: 2px;
  margin-bottom: 4px;
}

@media (max-width:920px) {
  nav .navbar{
    max-width: 100%;
    padding: 0 25px;
  }

  nav .navbar .logo a{
    font-size: 27px;
  }
  nav .links li{
    padding: 0 10px;
    white-space: nowrap;
  }
  nav .links li a{
    font-size: 15px;
  }
}
@media (max-width:800px){
  .navbar .menu-btn{
    display: inline-block;
  }
  nav .nav-links{
    position: fixed;
    top: 0;
    left: -100%;
    display: block;
    max-width: 290px;
    width: 100%;
    max-height: 100%;
    overflow-y: auto;
    background:  #1E8CBE;
    line-height: 40px;
    padding: 10px 20px;
    box-shadow: 0 5px 10px rgba(0, 0, 0, 0.2);
    transition: all 0.5s ease;
    z-index: 1000;
  }
  nav .sidebar-menu{
    display: flex;
    align-items: center;
    justify-content: space-between;
  }
  .menu-name{
    font-size: 25px;
    color: #fff;
  }
  
  nav .links{
    display: block;
    margin-top: 20px;
  }
  nav .links li{
    display: block;
  }
  nav .links li .sub-menu, nav .links li .sub-menu .sub-menu{
    position: relative;
    top: 0;
    left: 0;
    padding: 0;
    box-shadow: none;
    display: none;
  }
  nav .links li .sub-menu li{
    border-bottom: none;
  }
  nav .links li.show > .sub-menu {
    display: block;
  }

  nav li.show  > .arrow {
    transform: rotate(180deg);
  }

}
@media (max-width:370px){
  nav .navbar .nav-links{
  max-width: 100%;
} 
}
              
            
!

JS

              
                // search-box open close js code
let navbar = document.querySelector(".navbar");

// sidebar open close js code
let navLinks = document.querySelector(".nav-links");
let ulLinks = document.querySelector(".links");
let liSubmenu = document.querySelectorAll(".sub-menu");
let menuOpenBtn = document.querySelector("nav .menu-btn");
let menuCloseBtn = document.querySelector(".close-menu");
menuOpenBtn.onclick = function() {
navLinks.style.left = "0";
}
menuCloseBtn.onclick = function() {
navLinks.style.left = "-100%";
}
liSubmenu.forEach(item => item.parentNode.addEventListener('click', function(event){
  event.stopPropagation();
 this.classList.toggle('show');  
}))


              
            
!
999px

Console