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

              
                <h1>3D dropdown menu</h1>
<h3><a href="https://bit.ly/14XAO0z" target="_blank">Inspiration</a></h3>
<div class="menu">
  <span>Hover me for drop</span>
  <ul>
    <li>First drop</li>
    <li>Second drop</li>
    <li>Third drop</li>
    <li>Fourth drop</li>
  </ul>
</div>
              
            
!

CSS

              
                @import "compass/css3";

// As many dropdowns as you have, can be set beyond with no problems
$dropdowns: 4;
// Animation speed
$speed: .3;
// Don't mess with the two below
$delayCount: 0;
$delayCountReverse: $dropdowns*$speed;

* {
  @include box-sizing(border-box);
  margin: 0;
  padding: 0;
}

a {
  color: #3498db;
  text-decoration: none;
}

.menu {
  @include perspective(1000);
  width: 150px;
  margin: 20px auto;
}

h1, h3 {
  font-family: georgia;
  font-weight: 200;
  text-align: center;
  margin-top: 100px;
  font-size: 50px;
}

h3 {
  margin: 5px;
  font-size: 20px; 
}

ul {
  list-style: none;
}

.menu ul li, .menu span {
  display: block;
  width: 150px;
  height: 40px;
  padding: 10px 5px;
  background-color: #1abc9c;
  color: #fff;
  border-bottom: 1px solid #00A686;
  font-family: tahoma;
  cursor: pointer;
}

.menu span {
  background-color: #16a085;
  border: none;
  text-align: center;
  @include border-radius(2px);
  @include transition(border-radius, .5s);
}

.menu:hover span {
  @include border-radius(2px 2px 0 0);
}

.menu ul li {
  @include transform-origin(top, center, 0px);
  @include transform(rotateX(-90deg));
  @include opacity(0);
}

.menu ul li:last-of-type {
  border: none;
  @include border-radius(0 0 2px 2px);
}

.menu:hover ul li {
  @include transform(rotateX(0deg));
  @include opacity(1);
}

.menu ul li:hover {
  background-color: #34495e; 
}

@for $i from 1 through $dropdowns {
  $delayCount: $delayCount+$speed;
  $delayCountReverse: $delayCountReverse - $speed;
  .menu:hover ul li:nth-of-type(#{$i}) {
     @include transition(transform $speed+s $delayCount+s, opacity 0s $delayCount+s);
  }
  .menu ul li:nth-of-type(#{$i}) {
     @include transition(transform $speed+s $delayCountReverse+s, opacity 0s $delayCountReverse+$speed+s);
  }
}
              
            
!

JS

              
                
              
            
!
999px

Console