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

              
                <div class="nav">
  <div class="nav__logo">
    Find A Bed
  </div>
  <ul class="nav__links">
    <li>Home</li>
    <li>About</li>
    
    <li class="drop-down__wrap js-drop-down">
        Cities
        <ul class="drop-down__list">
          <li>
            <a href="www.toronto.ca">Toronto</a>
          </li>
          <li>
            <a href="www.london.com">London</a>
          </li>
          <li>
            <a href="www.tokyo.com">Tokyo</a>
          </li>
          <li>
            <a href="www.toronto.ca">Newyork</a>
          </li>
        </ul>
    </li>
      
    <li class="nav__link-list__item">Contact</li>
    
  </ul>
</div>
              
            
!

CSS

              
                *
  box-sizing: border-box

html
  position: relative
  width: 100%
  height: 100%

body
  width: 100%
  height: 100%
  background-image: url('https://images.unsplash.com/photo-1422393462206-207b0fbd8d6b?ixlib=rb-0.3.5&q=80&fm=jpg&crop=entropy&s=b09f84e8e8fd58ee91faf817b9f903d7')
  background-size: cover
  background-position: 50%

a
  text-decoration: none
  color: inherit

ul
  list-style-type: none

.nav
  height: 5em
  width: 100%
  padding-right: 4em
  padding-left: 4em
  font-family: 'Lato', 'Arial', sans-serif
  background-color: #375362
  
.nav__logo
  position: relative
  display: inline-block
  font-size: 2em
  font-weight: 900
  color: white
  text-transform: uppercase
  line-height: 2.5em
  
  &:before
    position: relative
    display: inline-block
    content: ""
    top: 10px
    margin-right: 10px
    width: 42px
    height: 42px
    background-image: url('https://s3-us-west-2.amazonaws.com/s.cdpn.io/149103/rest.svg')
    background-size: 100% auto
  
.nav__links
  float: right
  color: white
  line-height: 3em
  
  > li
    display: inline-block
    margin-right: 4em
    font-size: 1.2em
    cursor: pointer
    &:last-child
      margin-right: 0
  
.drop-down__wrap
  position: relative

.drop-down__list
  display: none
  position: absolute
  max-width: 300px
  padding: 1.2em 2.5em
  background-color: #ffffff
  border-radius: 5px
  transition: all 250ms ease
  opacity: 0
  
  > li
    display: block
    color: #919191
    font-size: 0.9em
    line-height: 2.5em
    transition: color 250ms ease
    
    &:hover
      color: #375362
    
.drop-down__list--visible
  > ul
    display: block
    opacity: 1
              
            
!

JS

              
                var dropDown = document.querySelector('.js-drop-down');

dropDown.addEventListener('mouseover', function( event ){
  this.classList.toggle('drop-down__list--visible');
});

dropDown.addEventListener('mouseout', function( event ){
  this.classList.toggle('drop-down__list--visible');
});
              
            
!
999px

Console