css Audio - Active file-generic CSS - Active Generic - Active HTML - Active JS - Active SVG - Active Text - Active file-generic Video - Active header Love html icon-new-collection icon-person icon-team numbered-list123 pop-out spinner split-screen star tv

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

You're using npm packages, so we've auto-selected Babel for you here, which we require to process imports and make it all work. If you need to use a different JavaScript preprocessor, remove the packages in the npm tab.

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

Use npm Packages

We can make npm packages available for you to use in your JavaScript. We use webpack to prepare them and make them available to import. We'll also process your JavaScript with Babel.

⚠️ This feature can only be used by logged in users.

Code Indentation

     

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.

HTML Settings

Here you can Sed posuere consectetur est at lobortis. Donec ullamcorper nulla non metus auctor fringilla. Maecenas sed diam eget risus varius blandit sit amet non magna. Donec id elit non mi porta gravida at eget metus. Praesent commodo cursus magna, vel scelerisque nisl consectetur et.

            
              <nav id='flexmenu'>
    <div class="logo">
      <a href=""><h1>style</h1></a>
    </div>

    <div id="mobile-toggle" class="button"></div>
    <ul id="main-menu">
      <li class='active'><a href='#'>Home</a></li>
      <li><a href='#'>Sale</a></li>
      <li><a href='#'>Shop</a>
         <ul class="sub-menu">
            <li><a href='#'>Product 1</a>
             <ul>
                <li><a href='#'>Sub Product</a></li>
                <li><a href='#'>Sub Product</a></li>
             </ul>
            </li>
            <li><a href='#'>Product 2</a>
             <ul>
                <li><a href='#'>Sub Product</a></li>
                <li><a href='#'>Sub Product</a></li>
             </ul>
            </li>
         </ul>
      </li>
      <li><a href='#'>Lookbook</a></li>
      <li><a href='#'>Locations</a></li>
      <li><a href='#'>Account</a></li>
    </ul>
  </nav>


  <section id="main">
     <div class="note">
      <h2>Responsive Menu Demo</h2>
      <p>  resize window  or</p>
       <p><a href="http://material.io/resizer/#url=http%3A%2F%2Fcodepen.io%2Fvailjoy%2Flive%2FRKxZxW" target="_blank">< view resizer ></a></p>
    </div>
  </section>

            
          
!
            
              *{
  margin:0;
  padding:0;
  text-decoration:none
}
html{
    height: 100%;
    width: 100%;
    overflow: hidden;
}
body {
    background: linear-gradient(#24222d, #070df9);
    font-family: 'lato', sans-serif;
}
nav {
    background: #2e1f62;
    position: relative;
    margin: 0 auto;
}

#flexmenu{
  display: flex;
  flex-flow: row wrap;
}
.logo {
    z-index: 123;
    padding: 10px;
    font: 18px 'yellowtail';
    color: #FFF;
    flex-grow: 1;
    flex-shrink: 1;
}
.logo a {
    color: #F14F80;
}

#main-menu{
  align-self: flex-end; 
}
/* keep the drop-downs from being hidden by content wrappers etc */
.sub-menu {
  z-index: 1234;
}

/* General Menu Styling */
#flexmenu li,
#flexmenu li a{
    border: 0;
    list-style: none;
    line-height: 1;
    display: inline-block;
    position: relative;
    text-transform: uppercase;
    transition: all ease-in-out .3s;
}

#flexmenu ul li a {
    padding: 17px;
    font-size: 12px;
    letter-spacing: 1px;
    text-decoration: none;
    color: #ddd;
    font-weight: 700;
}

#flexmenu ul li.has-sub > a {
    padding-right: 30px;
}
/* Drop icon */
#flexmenu ul li.has-sub > a:after {
    position: absolute;
    top: 22px;
    right: 11px;
    width: 8px;
    height: 2px;
    display: block;
    background: #F14F80;
    content: '';
}
#flexmenu ul ul li.has-sub > a:after {
    position: absolute;
    top: 16px;
    right: 11px;
    width: 8px;
    height: 2px;
    display: block;
    background: #FFF;
    content: '';
}
#flexmenu > ul > li.has-sub > a:before {
    position: absolute;
    top: 19px;
    right: 14px;
    display: block;
    width: 2px;
    height: 8px;
    background: #ddd;
    transition: all .25s ease;
}
#flexmenu > ul > li.has-sub:hover > a:before {
    top: 23px;
    height: 0;
}
#flexmenu ul ul li.has-sub > a:before {
    position: absolute;
    top: 13px;
    right: 14px;
    display: block;
    width: 2px;
    height: 8px;
    background: #FFF;
    content: '';
    transition: all .3s ease;
}
#flexmenu ul ul > li.has-sub:hover > a:before {
    top: 17px;
    height: 0;
}
#flexmenu ul ul li.has-sub:hover,
#flexmenu ul li.has-sub ul li.has-sub ul li:hover {
    background: #751CEC;
}
/* Submenu default states, removed by hover gives the animation */
#flexmenu ul ul {
    position: absolute;
    left: -9999px;
}
#flexmenu li:hover > ul {
    left: auto;
}
#flexmenu ul ul li {
    height: 0;
    background: #F14F80;
    transition: all .25s ease
}
#flexmenu li:hover > ul > li {
    height: 35px;
}
/* tertiary menu */
#flexmenu ul ul ul {
    margin-left: 100%;
    top: 0;
}
#flexmenu ul ul li a {
    padding: 11px 15px;
    width: 170px;
    font-size: 12px;
    text-decoration: none;
    color: #FFF;
    font-weight: 400;
}


/* Content */
#main{
  color: #FFF;
  height: 100vh;
  width: 100vw;
  background: url(https://s3-us-west-2.amazonaws.com/s.cdpn.io/927610/e-aupyxbjm-alice-moore.jpg) top center no-repeat;
  background-size: cover;
  position: relative;
  display: flex;
  justify-content: flex-end;
  align-items: center;
}

.note {
  width: 80vw;
  max-width: 320px;
  max-height: 200px;
  text-align: center;
  background: #F14F80;
  font-size: 1vw;
  padding: 10px;
  background-clip: padding-box;
}
.note h2 {
  font-weight: 300;
  font-size: 1.5em;
  margin: 10px 0 0;
}
.note p{
  margin: 5px;
}


@media screen and (max-width: 768px) {
  /* Center the logo and remove the bar */
    .logo {
        position: absolute;
        top: 0;
        left: 0;
        width: 100%;
        height: 46px;
        text-align: center;
        padding: 10px 0 0 0;
    }
  
  /* Hamburger */
    .button {
        background: #751CEC;
        width: 60px;
        height: 48px;
        position: absolute;
        right: 0;
        top: 0;
        cursor: pointer;
        z-index: 10000;
    }
    .button:after {
        position: absolute;
        top: 22px;
        right: 20px;
        display: block;
        height: 4px;
        width: 20px;
        border-top: 2px solid #dddddd;
        border-bottom: 2px solid #dddddd;
        content: '';
    }
    .button:before {
        transition: all .3s ease;
        position: absolute;
        top: 16px;
        right: 20px;
        display: block;
        height: 2px;
        width: 20px;
        background: #ddd;
        content: '';
    }
  /* Turn it into an X when open */
    .button.menu-opened{
      background: #2e1f62;
    }
    .button.menu-opened:after {
        transition: all .3s ease;    
        top: 23px;
        border: 0;
        height: 2px;
        width: 19px;
        background: #fff;
        transform: rotate(45deg);
    }
    .button.menu-opened:before {
        top: 23px;
        background: #fff;
        width: 19px;
        transform: rotate(-45deg);
    }
  /* reset horizontal styles */
    #flexmenu ul {
        display: none;
    }
    #flexmenu ul li,
    #flexmenu ul li a,
    #flexmenu ul ul li a{
        width: 100%;
    }

    #flexmenu ul ul li,
    #flexmenu li:hover > ul > li {
        height: auto;  
    }
    #flexmenu ul ul li a {
        padding-left: 25px;
    }
    #flexmenu ul ul ul li a {
        padding-left: 35px;
    }

    #flexmenu ul ul,
    #flexmenu ul ul ul {
        position: relative;
        left: 0;
        width: 100%;
        margin: 0;
        text-align: left;
    }
    #flexmenu ul ul ul li.active a {
        border-left: none;
    }
    #flexmenu > ul > li.has-sub > ul > li.focus > a,
    #flexmenu > ul ul > li.has-sub > ul > li.focus > a {
        background: #262626;
        transition: all .3s ease;
    }
  /* remove cross when menu item is toggled */
    #flexmenu > ul > li.has-sub > a:after,
    #flexmenu > ul > li.has-sub > a:before,
    #flexmenu ul ul > li.has-sub > a:after,
    #flexmenu ul ul > li.has-sub > a:before {
        display: none;
    }

  /* submenu toggles */
    #flexmenu .submenu-button {
        position: absolute;
        z-index: 99;
        right: 0;
        top: 0;
        display: block;
        border-left: 1px solid #444;
        height: 46px;
        width: 46px;
        cursor: pointer;
    }
    #flexmenu ul ul .submenu-button {
        height: 34px;
        width: 34px;
    }
    #flexmenu .submenu-button:after {
        position: absolute;
        top: 22px;
        right: 19px;
        width: 8px;
        height: 2px;
        display: block;
        background: #ddd;
        content: '';
    }
    #flexmenu ul ul .submenu-button:after {
        top: 15px;
        right: 13px;
    }
    #flexmenu .submenu-button.submenu-opened:after {
        background: #fff;
    }
    #flexmenu .submenu-button:before {
        position: absolute;
        top: 19px;
        right: 22px;
        display: block;
        width: 2px;
        height: 8px;
        background: #ddd;
        content: ''
    }
    #flexmenu ul ul .submenu-button:before {
        top: 12px;
        right: 16px;
    }
    #flexmenu .submenu-button.submenu-opened:before {
        display: none;
    }   
  
  .note{
    font-size: 3vw;
  }
}

            
          
!
            
              // See original by emre here https://codepen.io/emredenx/pen/ojcxl
$(document).ready(function ($) {
    $.fn.menumaker = function (options) {
        var flexmenu = $(this), settings = $.extend({
                format: 'dropdown',
                sticky: false
            }, options);
        return this.each(function () {
            $(this).find('.button').on('click', function () {
                $(this).toggleClass('menu-opened');
                var mainmenu = $(this).next('ul');
                if (mainmenu.hasClass('open')) {
                    mainmenu.slideToggle().removeClass('open');
                } else {
                    mainmenu.slideToggle().addClass('open');
                    if (settings.format === 'dropdown') {
                        mainmenu.find('ul').show();
                    }
                }
            });
            flexmenu.find('li ul').parent().addClass('has-sub');
            subToggle = function () {
                flexmenu.find('.has-sub').prepend('<span class="submenu-button"></span>');
                flexmenu.find('.submenu-button').on('click', function () {
                    $(this).toggleClass('submenu-opened');
                    if ($(this).siblings('ul').hasClass('open')) {
                        $(this).siblings('ul').removeClass('open').slideToggle();
                    } else {
                        $(this).siblings('ul').addClass('open').slideToggle();
                    }
                });
            };
            if (settings.format === 'multitoggle')
                subToggle();
            else
                flexmenu.addClass('dropdown');
            if (settings.sticky === true)
                flexmenu.css('position', 'fixed');
            resizeFix = function () {
                var mediasize = 768;
                if ($(window).width() > mediasize) {
                    flexmenu.find('ul').show();
                }
                if ($(window).width() <= mediasize) {
                    flexmenu.find('ul').hide().removeClass('open');
                }
            };
            resizeFix();
            return $(window).on('resize', resizeFix);
        });
    };

   $('#flexmenu').menumaker({ format: 'multitoggle' });
  
}(jQuery));
            
          
!
999px
🕑 One or more of the npm packages you are using needs to be built. You're the first person to ever need it! We're building it right now and your preview will start updating again when it's ready.
Loading ..................

Console