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="scene">
    <div class="menu">
        <input type="checkbox" id="open-menu" name="open-menu">
        
        <div class="menu__layer top">
            <label for="open-menu"><span class="fa fa-bars icon"></span><span class="layer__content">Home</span></label>
        </div>
        
        <div class="menu__layer middle">
            <label for="open-menu"><span class="layer__content">Portfolio</span></label>
        </div>
        
        <div class="menu__layer bottom">
            <label for="open-menu"><span class="layer__content">Contact</span></label>
        </div>
    </div>
</div>
              
            
!

CSS

              
                @import url(https://fonts.googleapis.com/css?family=Raleway:400,700);
/***** [Variables] *****/

/* Geometry */
$layer-size: 200px;
$top-height: 120px;
$middle-height: 80px;
$bottom-height: 40px;

/* Colors */
$color-background:  #C8F7C5;
$color-top: #E08283;
$color-middle: #81CFE0;
$color-bottom: #68C3A3;
$color-font: #eee;

/* Text */
$font: 'Raleway';
$icon-size: $layer-size / 2;
$text-size: $layer-size / 6;

/* Mixins */
@mixin center {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
}

@mixin shadow {
    -webkit-box-shadow: 10px 10px 60px 0px rgba(0,0,0,0.75);
    -moz-box-shadow: 10px 10px 60px 0px rgba(0,0,0,0.75);
    box-shadow: 10px 10px 60px 0px rgba(0,0,0,0.75);
}



/***** [Setup] *****/
body {
    font-family: $font;
    background: $color-background;
}

.scene {
    @include center;
    width: $layer-size;
    height: $layer-size;
    perspective: 1800px;

}

.menu {
    position: relative;
    width: inherit;
    height: inherit;
    transform: rotateX(45deg) rotateZ(45deg);
    transform-style: preserve-3d;
    
    
    
    /***** [Menu open state] *****/
    input[type="checkbox"] {
        visibility: hidden;
    }
    
    /* Show each layer's text */
    input[type="checkbox"]:checked ~ &__layer {
        label .layer__content {
            visibility: visible;
        }
    }

    input[type="checkbox"]:checked ~ .top {
        transform: translate3d(-$layer-size, 0, $bottom-height);

        /* Hide the menu icon */
        label .icon {
            visibility: hidden;
        }
    }
    input[type="checkbox"]:checked ~ .middle {
        transform: translate3d(0, 0, $bottom-height);
    }
    input[type="checkbox"]:checked ~ .bottom {
        transform: translate3d($layer-size, 0, $bottom-height);

        /* Hide the shadow */
        &:after {
            visibility: hidden;
        }
    }
    
    
    
    /**** [Hover state] *****/
    &:hover {
        .menu__layer {
            &.top {
                transform: translateZ($top-height);
            }
            &.middle {
                transform: translateZ($middle-height);
            }
            &.bottom {
                transform: translateZ($bottom-height);

                /* Show the shadow */
                &:after {
                    visibility: visible;
                }
            }
        }
    }

    
    
    /***** [Layer styling] *****/
    &__layer {
        position: absolute;
        width: inherit;
        height: inherit;
        transition: all 200ms ease;
        
        label {
            position: relative;
            display: inline-block;
            width: inherit;
            height: inherit;
            cursor: pointer;
            
            .icon,
            .layer__content {
                @include center;
                color: $color-font;
            }
            
            .icon {
                font-size: $icon-size;
            }
            
            .layer__content {
                visibility: hidden;
                font-size: $text-size;
                font-weight: bold;
            }
        }
          
        &.top {
            background-color: $color-top;
            z-index: 3;
        }
        
        &.middle {
            background-color: $color-middle;
            z-index: 2;

        }
        
        &.bottom {
            background-color: $color-bottom;
            z-index: 1;
            
            /* Shadow */
            &:after {
                position: absolute;
                top: 0;
                left: 0;
                width: inherit;
                height: inherit;
                content: "\00a0";
                visibility: hidden;
                @include shadow;
            }
        }
    }
}
              
            
!

JS

              
                
              
            
!
999px

Console