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.

Editor Settings

Code Indentation

Want to change your Syntax Highlighting theme, Fonts and more?

Visit your global Editor Settings.

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.

HTML

            
              <div class="container">
  <nav>
    <ul>
      <li data-position>
        <a href="#">Menu 1</a>
        <ul class="dropdown">
          <li>
            <a href="#">Submenu</a>
          </li>
          <li>
            <a href="#">Submenu</a>
          </li>
          <li>
            <a href="#">Submenu</a>
          </li>
          <li>
            <a href="#">Submenu</a>
          </li>
          <li>
            <a href="#">Submenu</a>
          </li>
        </ul>
      </li>
      <li data-position>
        <a href="#">Menu 2</a>
        <ul class="dropdown">
          <li>
            <a href="#">Submenu</a>
          </li>
          <li>
            <a href="#">Submenu</a>
          </li>
          <li>
            <a href="#">Submenu</a>
          </li>
          <li>
            <a href="#">Submenu</a>
          </li>
          <li>
            <a href="#">Submenu</a>
          </li>
        </ul>
      </li>
      <li data-position>
        <a href="#">Menu 3</a>
        <ul class="dropdown">
          <li>
            <a href="#">Submenu</a>
          </li>
          <li>
            <a href="#">Submenu</a>
          </li>
          <li>
            <a href="#">Submenu</a>
          </li>
          <li>
            <a href="#">Submenu</a>
          </li>
          <li>
            <a href="#">Submenu</a>
          </li>
        </ul>
      </li>
      <li data-position>
        <a href="#">Menu 4</a>
        <ul class="dropdown">
          <li>
            <a href="#">Submenu</a>
          </li>
          <li>
            <a href="#">Submenu</a>
          </li>
          <li>
            <a href="#">Submenu</a>
          </li>
          <li>
            <a href="#">Submenu</a>
          </li>
          <li>
            <a href="#">Submenu</a>
          </li>
        </ul>
      </li>
      <li data-position>
        <a href="#">Menu 5</a>
        <ul class="dropdown">
          <li>
            <a href="#">Submenu</a>
          </li>
          <li>
            <a href="#">Submenu</a>
          </li>
          <li>
            <a href="#">Submenu</a>
          </li>
          <li>
            <a href="#">Submenu</a>
          </li>
          <li>
            <a href="#">Submenu</a>
          </li>
        </ul>
      </li>
      <li data-position>
        <a href="#">Menu 6</a>
        <ul class="dropdown">
          <li>
            <a href="#">Submenu</a>
          </li>
          <li>
            <a href="#">Submenu</a>
          </li>
          <li>
            <a href="#">Submenu</a>
          </li>
          <li>
            <a href="#">Submenu</a>
          </li>
          <li>
            <a href="#">Submenu</a>
          </li>
        </ul>
      </li>
      <li data-position>
        <a href="#">Menu 7</a>
        <ul class="dropdown">
          <li>
            <a href="#">Submenu</a>
          </li>
          <li>
            <a href="#">Submenu</a>
          </li>
          <li>
            <a href="#">Submenu</a>
          </li>
          <li>
            <a href="#">Submenu</a>
          </li>
          <li>
            <a href="#">Submenu</a>
          </li>
        </ul>
      </li>
      <li data-position>
        <a href="#">Menu 8</a>
        <ul class="dropdown">
          <li>
            <a href="#">Submenu</a>
          </li>
          <li>
            <a href="#">Submenu</a>
          </li>
          <li>
            <a href="#">Submenu</a>
          </li>
          <li>
            <a href="#">Submenu</a>
          </li>
          <li>
            <a href="#">Submenu</a>
          </li>
        </ul>
      </li>
      <li data-position>
        <a href="#">Menu 9</a>
        <ul class="dropdown">
          <li>
            <a href="#">Submenu</a>
          </li>
          <li>
            <a href="#">Submenu</a>
          </li>
          <li>
            <a href="#">Submenu</a>
          </li>
          <li>
            <a href="#">Submenu</a>
          </li>
          <li>
            <a href="#">Submenu</a>
          </li>
        </ul>
      </li>
      <li data-position>
        <a href="#">Menu 10</a>
        <ul class="dropdown">
          <li>
            <a href="#">Submenu</a>
          </li>
          <li>
            <a href="#">Submenu</a>
          </li>
          <li>
            <a href="#">Submenu</a>
          </li>
          <li>
            <a href="#">Submenu</a>
          </li>
          <li>
            <a href="#">Submenu</a>
          </li>
        </ul>
      </li>
      <li data-position>
        <a href="#">Menu 11</a>
        <ul class="dropdown">
          <li>
            <a href="#">Submenu</a>
          </li>
          <li>
            <a href="#">Submenu</a>
          </li>
          <li>
            <a href="#">Submenu</a>
          </li>
          <li>
            <a href="#">Submenu</a>
          </li>
          <li>
            <a href="#">Submenu</a>
          </li>
        </ul>
      </li>
      <li data-position>
        <a href="#">Menu 12</a>
        <ul class="dropdown">
          <li>
            <a href="#">Submenu</a>
          </li>
          <li>
            <a href="#">Submenu</a>
          </li>
          <li>
            <a href="#">Submenu</a>
          </li>
          <li>
            <a href="#">Submenu</a>
          </li>
          <li>
            <a href="#">Submenu</a>
          </li>
        </ul>
      </li>
    </ul>
  </nav>
</div>
            
          
!

CSS

            
              $mainf : 'Roboto'

*
  box-sizing: border-box

body
  overflow: hidden

.container
  width: 1170px
  margin: auto
  max-width: 100%

nav
  font: 400 14px $mainf
  background: #000
  text-transform: uppercase
  
  ul
    display: flex
    flex-wrap: wrap
    
    li
      position: relative
      
      &:hover
        ul.dropdown
          opacity: 1
          visibility: visible
      
      a
        color: #FFF
        padding: 10px 20px
        display: block
        text-decoration: none
      
      ul.dropdown
        position: absolute
        left: 0
        top: 100%
        min-width: 180px
        flex-direction: column
        background: #000
        text-transform: capitalize
        padding: 5px 0
        opacity: 0
        visibility: hidden
        z-index: 1
        background: #080808
            
          
!

JS

            
              /*
    Author: Furkan KONYALI
    Web: fkonyali.com
    Mail: furkan.konyali@gmail.com
*/
(function($){
    'use strict';
    $.fn.AutoAlignment = function() {
        return this.each(function(){
            var _this = $(this);
          
            function resolve(){
                var left = _this.find('.dropdown').offset().left,
                    item_W = _this.find('.dropdown').outerWidth(),
                    right = ($(window).width() - (left + item_W));
              
                if(right < 0){
                    _this.find('.dropdown').css({'left': 'inherit', 'right': '0'});
                }else {
                    _this.find('.dropdown').css({'left': 'auto', 'right': 'auto'});
                }
            }
          
            resolve();
          
            $(window).resize(function(){
                resolve();
            });
        });
    }
 })(jQuery);

$(function(){
    $('[data-position]').AutoAlignment();
});
            
          
!
999px

Console