cssAudio - Activefile-genericCSS - ActiveGeneric - ActiveHTML - ActiveImage - ActiveJS - ActiveSVG - ActiveText - Activefile-genericVideo - ActiveLovehtmlicon-new-collectionicon-personicon-teamlog-outoctocatpop-outspinnerstartv

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.

Quick-add: + add another resource

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.

Quick-add: + add another resource

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.

            
              -@menuItems = ['publicinform', 'traffic control', 'cryoprison', 'administration', 'morality div', 'metro patrol']

-@subItems = ['publicinform', 'traffic control', 'cryoprison', 'administration', 'morality div', 'metro patrol']
.scanlines

.ui
    -@menuItems.each_with_index do |item, index|
        %input{:type => 'checkbox', :name => 'item', :id => "item-#{index + 1}"}
    .intro_wrap
        .intro
            %img{:src => 'https://s3-us-west-2.amazonaws.com/s.cdpn.io/217233/demolition-man.png'}
            %h1 80's / 90's Inspired UI's in CSS 
            %h2 Demolition Man 1993
            %img.gif{:src => 'https://s3-us-west-2.amazonaws.com/s.cdpn.io/217233/demogif.gif'}
            %p A recreation of the Demolition Man 3D Hexagon Foldout menu in CSS only. Nice and cheesy. Not an exact replica for sure, perspectives are off slightly, but still looks good!
    .ui_inner
        -@menuItems.each_with_index do |item, index|
            .ui_inner__item
                %label{:for => "item-#{index + 1}"}
                    %span back
                %h2 #{item}
                .item_top
                .item_bottom
                -@subItems.each_with_index do |item, index|
                    .item_wrap{:class => "item-#{index + 1}"}
                        .item_active
                            .item_active__part
                                .nodes
                                %h3 #{item}

            
          
!
            
              // Demolition man fontage

@import url('https://fonts.googleapis.com/css?family=Nunito:400,700');

@font-face {
    font-family: 'Superguns';
    src: url('https://s3-us-west-2.amazonaws.com/s.cdpn.io/217233/Superguns.woff2') format('woff2'),
        url('https://s3-us-west-2.amazonaws.com/s.cdpn.io/217233/Superguns.woff') format('woff');
    font-weight: normal;
    font-style: normal;
}

// Colors
$bg: #021013;
$text: #c39d7e;
$triangleBg: #032035;

// Dims
$triangleWidth: 400px;
$triangleHeight: 40px;
$triangleAltitude: 0.5 * 1.73205080757 * $triangleWidth + 0px;
$triangleGap: 16px;
$itemCount: 6;

// Transition
$hueRotation: 10;
$verticalOffset: calc(50vh - 130px);
$horizontalOffset: 200px;
$rotationOffset: -10deg;
$moveAmount: 2100px;

// Perspective
$globalPerspective: 1300px;

%absPosition {
    position: absolute;
    top: 50%;
    left: 0;
    right: 0;
    margin: auto;
    transform: translateY(-50%);
}

%killInteraction {
    pointer-events: none;
    -webkit-user-select: none;
    -moz-user-select: none; 
    -ms-user-select: none;
}

%triangleSides {
    width: $triangleWidth;
    height: $triangleHeight;
    background: $triangleBg;
    position: absolute;
    top: 0;
    display: block;
    content: '';  
    backface-visibility: none;
    transition: all 0.6s;
}

%triangleTop {
    border-left: $triangleWidth / 2 solid transparent;
    border-right: $triangleWidth / 2 solid transparent;
    border-bottom: $triangleAltitude solid $triangleBg;
    transform: translateY(-$triangleAltitude) rotateX(90deg);
    backface-visibility: none;
    position: absolute;
    transform-origin: 100% 100%;
    transition: all 0.0s;
}

%trianglePart {
    @extend %triangleTop;
    
    border-left: $triangleWidth / 2 solid transparent;
    border-right: $triangleWidth / 2 solid transparent;
    border-top: $triangleAltitude solid $triangleBg;
    border-bottom: 0;
}

// Traverse DOM for easy interactions
@mixin traverse($n) {
    $item: '';
    $tab: '';

    @for $i from 1 through $n {
        $int: #{($n + 1) - $i};
        
        & #item-#{$int}:checked #{$item} + div {
            opacity: 0;
            left: -100px;
            transition: opacity 0.2s, left 0.4s;
        }
        
        & #item-#{$int}:checked #{$item} + div + div {
            transform: rotatex(-30deg) rotateY(-60deg) translateZ(0);
            top: -100px - ((($n + 1) - $i - 1) * 50);
            left: 0;

            & > .ui_inner__item {
                transform: translateY(calc(50vh - #{$moveAmount})) translateX(-$triangleWidth / 2);
                
                // Why does syntax highlighting mess up here?
                label {
                    transition: background 0.6s 5s;
                    transform: rotatey(60deg) rotatex(90deg) translatex(149px) translateZ(70px) translateY(295px);
                    background: #000000b3;
                    width: 160px;
                    padding: 20px;
                    border-radius: 6px;
                        
                    span {
                        opacity: 1;
                        transition: all 0.6s 5s;
                    }
                }
                
                &:hover {
                    background: -webkit-linear-gradient(left, $bg 30%, adjust-hue($triangleBg, -(($n) - $i) * $hueRotation) 70%, $bg 100%);
                    
                    & .item_top,
                    & .item_bottom {
                        border-bottom: $triangleAltitude solid adjust-hue($triangleBg, -(($n) - $i) * $hueRotation); 
                    }
                    
                    &::after,
                    &::before {
                        background: -webkit-linear-gradient(left, $bg 30%, adjust-hue($triangleBg, -(($n) - $i) * $hueRotation) 70%, $bg 100%);
                    }
                }
                    
                & .item_wrap {
                    
                    & .item_active {
                        &:after {
                            transition: all 1s 5s;
                            opacity: 1;
                        }
                    }
                        &:nth-of-type(6) {
                            & .item_active__part {
                                h3 {
                                    transform: translateX(-246px) rotateY(0deg) rotateX(180deg);
                                }
                            }
                        }
                        
                        &:nth-of-type(5) {
                            & .item_active__part {
                                h3 {
                                    transform: translateX(-246px) rotateY(0deg) rotateX(180deg);
                                }
                            }
                        }
                        
                        &:nth-of-type(4) {
                            & .item_active__part {
                                h3 {
                                    transform: translateX(-246px) rotateY(0deg) rotateX(180deg);
                                }
                            }
                        }
                    
                        &:nth-of-type(8) {
                            & .item_active__part {
                                h3 {
                                    transform: translateX(-246px);
                                    animation: fadeIn 0.5s (0 * 0.5s) + 1.7s forwards !important;
                                }
                                    
                                .nodes {
                                    animation: fadeIn 0.5s (0 * 0.5s) + 1.7s forwards !important;
                                }
                            }
                        }
                        
                        @for $v from 2 through $itemCount + 2 {
                            &:nth-of-type(#{$v}) {
                                & .item_active__part {
                                    @keyframes fadeIn {
                                        to {opacity: 1;}
                                    }
                                    
                                    h3,
                                    .nodes {
                                        animation: fadeIn 0.5s ($v * 0.5s) + 1.5s forwards;
                                    }
                                }
                            }
                        }

                        @for $v from 1 through $itemCount - 1 {
                            &:nth-of-type(#{$v + 2}) {
                                @extend %killInteraction;
                                
                                transform: rotateY(-60deg * ($v - 1));
                                
                                & .item_active__part {
                                        opacity: 0;
                                        animation: flip 0.5s ($v * 0.5s) + 2s forwards;
                                        backface-visibility: none;
                                }
                            }
                        }
                    }
                    
                    &:nth-of-type(#{$int}) {
                        transform: translateY(calc(50vh + 100px)) translateX(-$triangleWidth / 2);
                        animation: flash-#{$int} 0.3s linear;

                        h2 {
                            transition: opacity 0.2s 1.4s;
                        }

                        & .item_top, 
                        & .item_bottom {
                            animation: flashTop-#{$int} 0.3s linear;
                        }
                    }
                    
                    @for $p from 1 through 5 {
                        &:nth-of-type(#{($n + 1) - $i + $p}) {
                            transform: translateY(calc(-50% + #{$moveAmount})) translateX(-$triangleWidth / 2);
                        }
                    }

                    h2 {
                        opacity: 0;
                    }
                }
            }

        $item: $item + '+ input';
        $tab: $tab + '+ div';
    }
}

body {
    background: $bg;
    overflow: hidden;
    font-family: 'Superguns';
    letter-spacing: 1px;
    margin: 0;

    & .scanlines {
        @extend %killInteraction;
        
        background-image: repeating-linear-gradient(180deg, transparent, transparent 3px, rgba(224, 167, 167, 0.03) 9px, rgba(255, 255, 255, 0.1) 9px);
        position: absolute;
        height: 100%;
        width: 100%;
        top: 0;
        z-index: 1;
    }
    

    & .intro_wrap {
        height: 100vh;
        transition: opacity 0.2s 1.7s, left 0.4s 1.7s;
        position: relative;
        left: 0;
    }
    
    & .intro {
        position: absolute;
        width: 370px;
        left: -530px;
        font-family: 'Nunito', sans-serif;
        right: 0;
        margin: auto;
        text-align: center;
        top: 50%;
        -webkit-transform: translateY(-50%);
        transform: translateY(-50%);
        
        img {
            width: 150px;    
            margin-top: 17px;
        }
        
        & .gif {
            margin-top: 14px;
            border: 2px solid white;
            border-radius: 4px;
            width: 250px;
        }
        
        h1 {
            color: #bf9a7c;
            font-size: 16px;
            margin: 10px 0 0;
        }

        h2 {
            margin: 0;
            font-size: 14px;
            color: #51b8d8
        }
        
        p {
            color: #c8cdc4;
            font-size: 12px;
        }
    }

    & .ui {
        @include traverse($itemCount);
        
        perspective: $globalPerspective;
        height: 100%;
        opacity: 0;
        animation: fadeIn 2.5s 0.3s forwards;
        
        & input {
            display: none;
        }

        &_inner {
            @extend %absPosition;
            
            top: $verticalOffset;
            left: $horizontalOffset;
            transform: rotateY($rotationOffset);
            transform-style: preserve-3d;
            transition: all 2s 0.4s;
            height: 0;
            width: 100%;

            &__item {
                @extend %absPosition;

                width: $triangleWidth;
                height: $triangleHeight;
                transition: all 0.6s, transform 2s 0.4s;
                transform-style: preserve-3d;
                transform-origin: 0% 0%;

                label {
                    position: absolute;
                    height: 131%;
                    width: 100%;
                    display: block;
                    background: none;
                    z-index: 1;
                    cursor: pointer;
                    transition: background 0.6s 0s;
                    text-align: center;
                    color: white;
                    text-transform: uppercase;

                    span {
                        opacity: 0;
                        top: 9px;
                        position: relative;
                        transition: all 0s 0s;
                    }
                }

                h2 {
                    @extend %absPosition;
                    @extend %killInteraction;
                    
                    right: $triangleHeight / 2;
                    color: $text;
                    transform: translateY(-50%) translatez(10px);
                    transition: opacity 0.2s 0.3s;
                    font-weight: normal;
                    font-size: 14px;
                    left: auto;
                    text-transform: uppercase;
                }

                &::after {
                    @extend %triangleSides;

                    transform: rotateY(60deg);
                    transform-origin: 0 0;
                }

                &::before {
                    @extend %triangleSides;

                    transform: rotateY(-60deg);
                    transform-origin: 100% 0;
                }

                & .item_top {
                    @extend %triangleTop;
                }

                & .item_bottom {
                    @extend %triangleTop;

                    transform: translateY(-$triangleAltitude + $triangleHeight) rotateX(90deg);
                }
                
                
                & .item_wrap {
                    transform: rotatey(0deg);
                    transform-origin: $triangleWidth 100%;
                    transform-style: preserve-3d;
                }

                & .item_active {      
                    transform: rotateY(30deg) translateX(-55px) translateZ(-$triangleWidth / 2);
                    transform-origin: 100% 100%;
                    position: absolute;
                    transform-style: preserve-3d;
                        
                    &::after {
                        display: block;
                        content: '';
                        width: 400px;
                        height: 30px;
                        transition: all 0s 0s;
                        opacity: 0;
                        position: absolute;
                        top: 0px;
                        transform: rotatex(0deg) rotatez(180deg) translateY(29px) rotateY(30deg) translateX(-748px) translateZ(-200px);
                        transform-origin: 0% 100%;
                    }
                    
                    @for $i from 1 through $itemCount {
                        &:nth-of-type(#{$i}) {
                            &::after {
                                background: adjust-hue($triangleBg, -($i - 1) * $hueRotation)
                            }
                        }
                    }
                
                    &__part {
                        @extend %trianglePart;
                        @extend %killInteraction;
                        
                        transform: rotatex(90deg) rotatey(0deg) rotateZ(-30deg) translateX(0px) translateY(0px);
                        transform-origin: 100% 0;
                        transform-style: preserve-3D;

                        & .nodes {
                            width: 20px;
                            height: 20px;
                            position: absolute;
                            border: 3px solid white;
                            opacity: 0;
                            border-radius: 100px;
                            top: -315px;
                            left: -132px;
                            transform: translateZ(1px);
                        }
                        
                        h3 {
                            @extend %killInteraction;
                            position: absolute;
                            top:- $triangleAltitude - 60;
                            width: 500px;
                            left: 0;
                            right: 0;
                            margin: auto;
                            text-transform: uppercase;
                            transform-style: preserve-3D;
                            transform: rotateX(-20deg) rotatey(180deg) translateX(50%);
                            color: #c39d7e;
                            font-weight: normal;
                            text-align: center;
                            font-size: 28px;
                            opacity: 0;
                        }
                        
                        @keyframes flip {
                            from {opacity: 1;transform: rotatex(90deg) rotatey(0deg) rotateZ(-30deg) translateX(0px) translateY(0px)}
                            to {opacity: 1;transform: rotatex(90deg) rotatey(180deg) rotateZ(-30deg) translateX(0px) translateY(0px)}
                        }
                    }
                }

                @for $i from 1 through $itemCount {
                    &:nth-of-type(#{$i}) {
                        top: calc(50% + (#{$i - 1} * #{$triangleGap}) + (#{$triangleHeight} * #{$i - 1}));
                        background: -webkit-linear-gradient(left, $bg 30%, adjust-hue($triangleBg, -($i - 1) * $hueRotation) 70%, $bg 100%);
                        $c: adjust-hue($triangleBg, -($i - 1) * $hueRotation); 
                        
                        & .nodes {
                            box-shadow: 40px 0px 0 -3px $c, 40px 0px 0px 0px white, 80px 0px 0 -3px $c, 
                                80px 0px 0px 0px white, 120px 0px 0 -3px $c, 120px 0px 0px 0px white, 
                                160px 0px 0 -3px $c, 160px 0px 0px 0px white, 200px 0px 0 -3px $c, 
                                200px 0px 0px 0px white, 240px 0px 0 -3px $c, 240px 0px 0px 0px white, 
                                20px 40px 0 -3px $c, 20px 40px 0px 0px white, 60px 40px 0 -3px $c, 
                                60px 40px 0px 0px white, 100px 40px 0 -3px $c, 100px 40px 0px 0px white, 
                                140px 40px 0 -3px $c, 140px 40px 0px 0px white, 180px 40px 0 -3px $c, 
                                180px 40px 0px 0px white, 220px 40px 0 -3px $c, 220px 40px 0px 0px white, 
                                40px 80px 0 -3px $c, 40px 80px 0px 0px white, 80px 80px 0 -3px $c, 80px 80px 0px 0px white, 
                                120px 80px 0 -3px $c, 120px 80px 0px 0px white, 160px 80px 0 -3px $c, 
                                160px 80px 0px 0px white, 200px 80px 0 -3px $c, 200px 80px 0px 0px white, 
                                60px 120px 0 -3px $c, 60px 120px 0px 0px white, 100px 120px 0 -3px $c, 
                                100px 120px 0px 0px white, 140px 120px 0 -3px $c, 140px 120px 0px 0px white, 
                                180px 120px 0 -3px $c, 180px 120px 0px 0px white, 80px 160px 0 -3px $c, 
                                80px 160px 0px 0px white, 120px 160px 0 -3px $c, 120px 160px 0px 0px white, 
                                160px 160px 0 -3px $c, 160px 160px 0px 0px white, 100px 200px 0 -3px $c, 
                                100px 200px 0px 0px white, 140px 200px 0 -3px $c, 140px 200px 0px 0px white, 
                                120px 240px 0 -3px $c, 120px 240px 0px 0px white
                        }

                        @keyframes flash-#{$i} {
                            0% {background: -webkit-linear-gradient(left, $bg 30%, #ad988e 70%, $bg 100%);}
                            25% {background: -webkit-linear-gradient(left, $bg 30%, adjust-hue($triangleBg, -($i - 1) * $hueRotation) 70%, $bg 100%);}
                            50% {background: -webkit-linear-gradient(left, $bg 30%, #ad988e 70%, $bg 100%);}
                            75% {background: -webkit-linear-gradient(left, $bg 30%, adjust-hue($triangleBg, -($i - 1) * $hueRotation) 70%, $bg 100%);}
                            100% {background: -webkit-linear-gradient(left, $bg 30%, #ad988e 70%, $bg 100%);}
                        }
                        
                        @keyframes flashTop-#{$i} {
                            0% {border-bottom: $triangleAltitude solid #ad988e; }
                            25% {border-bottom: $triangleAltitude solid adjust-hue($triangleBg, -($i - 1) * $hueRotation); }
                            50% {border-bottom: $triangleAltitude solid #ad988e; }
                            75% {border-bottom: $triangleAltitude solid adjust-hue($triangleBg, -($i - 1) * $hueRotation); }
                            100% {border-bottom: $triangleAltitude solid #ad988e; }
                        }

                        &::after,
                        &::before {
                            background: -webkit-linear-gradient(left, $bg 30%, adjust-hue($triangleBg, -($i - 1) * $hueRotation) 70%, $bg 100%);
                        }

                        & .item_top,
                        & .item_bottom {
                            border-bottom: $triangleAltitude solid adjust-hue($triangleBg, -($i - 1) * $hueRotation); 
                        }
                        
                        & .item_active__part {
                            border-top: $triangleAltitude solid adjust-hue($triangleBg, -($i - 1) * $hueRotation); 
                        }

                        &:hover {
                            background: -webkit-linear-gradient(left, $bg 30%, #ad988e 70%, $bg 100%);

                            &::after,
                            &::before {
                                background: -webkit-linear-gradient(left, $bg 30%, #ad988e 70%, $bg 100%);
                            }

                            & .item_top,
                            & .item_bottom {
                                border-bottom: $triangleAltitude solid #ad988e; 
                            }
                        }
                    }
                }
            }
        }
    }
}
            
          
!
999px
Loading ..................

Console