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="text">
    <div class="title">
        Pulp Fiction
    </div>
    Hover the briefcase
</div>
<div class="briefcase">

    <div class="bottom">
        <div class="front">
            <div class="lock"></div>
            <div class="lock"></div>
            <div class="handle_conn"></div>
            <div class="handle_conn"></div>
        </div>
        <div class="back"></div>
        <div class="left"></div>
        <div class="right"></div>
    </div>

    <div class="handle">
        <div class="handle_grip"></div>
        <div class="handle_blur1"></div>
        <div class="handle_blur2"></div>
    </div>

    <div class="top">
        <div class="up"></div>
        <div class="right"></div>
        <div class="left"></div>
        <div class="front">
            <div class="lockTop"></div>
            <div class="lockTop"></div>
        </div>
        <div class="light"></div>
    </div>

</div>

<a href="https://twitter.com/amit_sheen" class="twitterLink" target="_blank">
   <img src="https://assets.codepen.io/1948355/twitterLogo2.png" />
</a>

              
            
!

CSS

              
                @import url('https://fonts.googleapis.com/css2?family=Anton&display=swap');

*, *::before, *::after {
    padding: 0;
    margin: 0 auto;
    box-sizing: border-box;
}

body {
    font-family: 'Anton', sans-serif;
    background-color: #39332b;
    background-image: linear-gradient(#222, #39332b calc(50% + 120px), #222 calc(50% + 120px), #171717);
    color: #666;
    min-height: 100vh;
    display: flex;
    justify-content: center;
    align-items: center;
}

.text {
    position: absolute;
    top: 0; left: 0;
    padding: 1em;

    .title {
        color: #333;
        font-size: 4em;
        filter: drop-shadow(0 6px 0 #000);
    }
}

$wTra: rgba(255, 255, 255, 0.025);
$bTra: rgba(0, 0, 0, 0.025);

.briefcase {
    perspective: 840px;
    perspective-origin: top;
    transform-style: preserve-3d;
    width: 420px;
    height: 210px;
    --yAngle: -20deg;
    transform: translateY(50%) scale(1.5);

    &:hover {

        .bottom, .handle {
            --yAngle: 160deg;
            transition: transform 2s;
        }

        .lockTop:nth-child(1)::after {
            transform: translateY(-22px);
            transition: transform 0.5s 2.25s
        }

        .lockTop:nth-child(2)::after {
            transform: translateY(-22px);
            transition: transform 0.5s 2s
        }

        .top {
            animation: topBack 8s;
            animation-fill-mode: forwards;

            @keyframes topBack {
                0% { transform: translate(-50%, 0%) rotateY(var(--yAngle)) translateZ(-80px) rotateX(0deg); }
                25%, 40% { transform: translate(-50%, 0%) rotateY(calc(var(--yAngle) + 180deg)) translateZ(-80px) rotateX(0deg); }
                100% { transform: translate(-50%, 0%) rotateY(calc(var(--yAngle) + 180deg)) translateZ(-80px) rotateX(90deg); }
            }
        }

        .top .light {
            background-color: gold;
            filter: blur(25px);
            transition: all 4s 3s;
            top: 40px
        }
    }
}

@mixin tops() {
    position: absolute;
    background-color: #111;
    background-image: linear-gradient($wTra 20%, $bTra);
}

@mixin bottoms() {
    position: absolute;
    background-color: #111;
    background-image: linear-gradient($wTra 20%, $bTra 50%, $wTra 60%, $bTra);
}

.top {
    @include tops();
    left: 50%; bottom: 50%;
    width: 320px;
    height: 20px;
    transform: translate(-50%, 0%) rotateY(var(--yAngle)) translateZ(-80px) ;
    transform-origin: bottom;
    transform-style: preserve-3d;

    & > * {
        @include tops();
    }

    .light {
        left: 0%; top: 20px;
        width: 320px;
        height: 160px;
        transform: rotateX(90deg);
        transform-origin: top;
        background-color: #111;
    } 

    .up {
        left: 0%; top: 0%;
        width: 320px;
        height: 160px;
        transform: rotateX(90deg);
        transform-origin: top;
    } 
    
    .right {
        left: 100%; top: 0%;
        width: 160px;
        height: 20px;
        transform: rotateY(-90deg);
        transform-origin: left;
    }

    .left {
        left: 0%; top: 0%;
        width: 160px;
        height: 20px;
        transform: rotateY(-90deg);
        transform-origin: left;
    }

    .front {
        left: 0%; top: 0%;
        width: 320px;
        height: 20px;
        transform: translateZ(160px);
        transform-style: preserve-3d;
    }

    .lockTop {
        position: absolute;
        bottom: 0;
        width: 56px;
        height: 8px;
        background-color: goldenrod;
        background-image: linear-gradient($wTra 20%, $bTra);
        transform: translateZ(0.1px);

        &:nth-child(1) {
            left: 36px;
            
            &::before { right: 3px; }
            &::after { right: 6px; }
        }
        
        &:nth-child(2) {
            right: 36px;
            
            &::before { left: 3px; }
            &::after { left: 6px; }
        }
    
        &::before {
            content: '';
            position: absolute;
            top: 3px;
            width: 14px;
            height: 2px;
            background-color: #0001;
            border-radius: 2px;
            box-shadow: 0px 0px 2px #0008;
        }
    
        &::after {
            content: '';
            position: absolute;
            top: 4px;
            width: 8px;
            height: 16px;
            background-color: goldenrod;
            border-radius: 1px;
            box-shadow: 1px 1px 4px #0008;
        }
    }
}

.bottom {
    position: absolute;
    background-color: #111;
    left: 50%; top: 50%;
    width: 320px;
    height: 160px;
    transform: translate(-50%, -25%) rotateY(var(--yAngle)) rotateX(90deg);
    transform-style: preserve-3d;
    // box-shadow: 0 0 10px #000;

    & > * {
        @include bottoms();
    }

    .left {
        right: 0%; top: 75%;
        width: 160px;
        height: 40px;
        transform: rotateY(-90deg) rotateZ(90deg);
        transform-origin: bottom right;
    }

    .right {
        left: 0%; top: -25%;
        width: 160px;
        height: 40px;
        transform: rotateY(-90deg) rotateZ(90deg);
        transform-origin: bottom left;
    }

    .back {
        left: 0%; top: -25%;
        width: 320px;
        height: 40px;
        transform: rotateX(-90deg);
        transform-origin: bottom;
    }

    .front {
        left: 0%; top: 75%;
        width: 320px;
        height: 40px;
        transform: rotateX(-90deg);
        transform-origin: bottom;
    }
}

.lock {
    position: absolute;
    top: 0;
    width: 56px;
    height: 16px;
    background-color: goldenrod;
    background-image: linear-gradient($wTra 20%, $bTra);

    &:nth-child(1) {
        left: 36px;
        
        &::before { left: 4px; }
        &::after { left: 16px; }
    }
    
    &:nth-child(2) {
        right: 36px;
        
        &::before { right: 4px; }
        &::after { right: 16px; }
    }

    &::before {
        content: '';
        position: absolute;
        top: 4px;
        width: 8px;
        height: 8px;
        background-color: goldenrod;
        border-radius: 2px;
        box-shadow: 1px 1px 4px #0008;
    }

    &::after {
        font-size: 5px;
        color: #000;
        content: '6 | 6 | 6';
        display: flex;
        justify-content: center;
        align-items: center;
        position: absolute;
        top: 4px;
        width: 20px;
        height: 8px;
        border-radius: 1px;
        box-shadow: inset 0px -3px 6px #0008;
    }
}

.handle {
    position: absolute;
    left: 50%; top: 50%;
    width: 100px;
    height: 80px;
    transform: translate(-50%, -50%) rotateY(var(--yAngle)) rotateX(45deg) translateY(70px) translateZ(50px);
    border-radius: 40px;
    overflow: hidden;

    &_conn {
        position: absolute;
        top: 8px;
        width: 24px;
        height: 4px;
        background-color: goldenrod;
        border-radius: 2px;
        background-image: linear-gradient($wTra 20%, $bTra);
    
        &:nth-child(3) {
            left: 109px;
        }
        
        &:nth-child(4) {
            right: 109px;
        }
    }

    &_grip {
        position: absolute;
        left: 0%; top: 0%;
        width: 100px;
        height: 80px;
        border-radius: 40px;
        border: 20px solid black;
    }
    
    &_blur1, &_blur2 {
        content: '';
        position: absolute;
        border: solid rgba(255, 255, 255, 0.1);
        border-radius: 40px;
        filter: blur(5px);
    }

    &_blur1 {
        left: 0; top: 0;
        width: 90px;
        height: 80px;
        border-width: 0 0 0 10px;
    }

    &_blur2 {
        left: 10px; top: 10px;
        width: 85px;
        height: 60px;
        border-width: 0 10px 0 0;
    }
}

.twitterLink {
  position: fixed;
  bottom: 0.5em; right: 0.5em;
  & img {
    width: 2em;
    filter: grayscale(100%);
    transition: filter 0.25s;
    &:hover {
      filter: grayscale(0%);
    }
  }
}
              
            
!

JS

              
                
              
            
!
999px

Console