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

              
                <input type="checkbox" id="wf" class="wireframe_input">
<label for="wf" class="wireframe_label">Wireframe</label>

<div class="hoverPad"></div>
<div class="hoverPad"></div>
<div class="hoverPad"></div>
<div class="hoverPad"></div>
<div class="hoverPad"></div>
<div class="hoverPad"></div>
<div class="hoverPad"></div>
<div class="hoverPad"></div>
<div class="hoverPad"></div>
<div class="hoverPad"></div>

<div class="towerOuter">
  <div class="tower">
    <div class="card"></div><div class="card"></div><div class="card"></div><div class="card"></div><div class="card"></div><div class="card"></div>
    <div class="card"></div><div class="card"></div><div class="card"></div><div class="card"></div><div class="card"></div><div class="card"></div>
    <div class="card"></div><div class="card"></div><div class="card"></div><div class="card"></div><div class="card"></div><div class="card"></div>
    <div class="card"></div><div class="card"></div><div class="card"></div><div class="card"></div><div class="card"></div><div class="card"></div>
    <div class="card"></div><div class="card"></div><div class="card"></div><div class="card"></div><div class="card"></div><div class="card"></div>
    <div class="card"></div><div class="card"></div><div class="card"></div><div class="card"></div><div class="card"></div><div class="card"></div>
    <div class="card"></div><div class="card"></div><div class="card"></div><div class="card"></div><div class="card"></div><div class="card"></div>
    <div class="card"></div><div class="card"></div><div class="card"></div><div class="card"></div><div class="card"></div><div class="card"></div>
    <div class="card"></div><div class="card"></div><div class="card"></div><div class="card"></div><div class="card"></div><div class="card"></div>
    <div class="card"></div><div class="card"></div><div class="card"></div><div class="card"></div><div class="card"></div><div class="card"></div>
    <div class="card"></div><div class="card"></div><div class="card"></div><div class="card"></div><div class="card"></div><div class="card"></div>
    <div class="card"></div><div class="card"></div><div class="card"></div><div class="card"></div><div class="card"></div><div class="card"></div>

    <div class="card"></div><div class="card"></div><div class="card"></div><div class="card"></div><div class="card"></div><div class="card"></div>
    <div class="card"></div><div class="card"></div><div class="card"></div><div class="card"></div><div class="card"></div><div class="card"></div>
    <div class="card"></div><div class="card"></div><div class="card"></div><div class="card"></div><div class="card"></div><div class="card"></div>
    <div class="card"></div><div class="card"></div><div class="card"></div><div class="card"></div><div class="card"></div><div class="card"></div>
    <div class="card"></div><div class="card"></div><div class="card"></div><div class="card"></div><div class="card"></div><div class="card"></div>
    <div class="card"></div><div class="card"></div><div class="card"></div><div class="card"></div><div class="card"></div><div class="card"></div>
    <div class="card"></div><div class="card"></div><div class="card"></div><div class="card"></div><div class="card"></div><div class="card"></div>
    <div class="card"></div><div class="card"></div><div class="card"></div><div class="card"></div><div class="card"></div><div class="card"></div>
    <div class="card"></div><div class="card"></div><div class="card"></div><div class="card"></div><div class="card"></div><div class="card"></div>
    <div class="card"></div><div class="card"></div><div class="card"></div><div class="card"></div><div class="card"></div><div class="card"></div>
    <div class="card"></div><div class="card"></div><div class="card"></div><div class="card"></div><div class="card"></div><div class="card"></div>
    <div class="card"></div><div class="card"></div><div class="card"></div><div class="card"></div><div class="card"></div><div class="card"></div>

    <div class="card"></div><div class="card"></div><div class="card"></div><div class="card"></div><div class="card"></div><div class="card"></div>
    <div class="card"></div><div class="card"></div><div class="card"></div><div class="card"></div><div class="card"></div><div class="card"></div>
    <div class="card"></div><div class="card"></div><div class="card"></div><div class="card"></div><div class="card"></div><div class="card"></div>
    <div class="card"></div><div class="card"></div><div class="card"></div><div class="card"></div><div class="card"></div><div class="card"></div>
    <div class="card"></div><div class="card"></div><div class="card"></div><div class="card"></div><div class="card"></div><div class="card"></div>
    <div class="card"></div><div class="card"></div><div class="card"></div><div class="card"></div><div class="card"></div><div class="card"></div>
    <div class="card"></div><div class="card"></div><div class="card"></div><div class="card"></div><div class="card"></div><div class="card"></div>
    <div class="card"></div><div class="card"></div><div class="card"></div><div class="card"></div><div class="card"></div><div class="card"></div>
    <div class="card"></div><div class="card"></div><div class="card"></div><div class="card"></div><div class="card"></div><div class="card"></div>
    <div class="card"></div><div class="card"></div><div class="card"></div><div class="card"></div><div class="card"></div><div class="card"></div>
    <div class="card"></div><div class="card"></div><div class="card"></div><div class="card"></div><div class="card"></div><div class="card"></div>
    <div class="card"></div><div class="card"></div><div class="card"></div><div class="card"></div><div class="card"></div><div class="card"></div>

    <div class="shadow"></div>
  </div>
</div>
              
            
!

CSS

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

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

:root {
    --perspectivOriginY: 25%;
}

body {
    font-family: 'Anton', sans-serif;
    background-color: #151515;
    color: #aaa;
    min-height: 100vh;
    display: flex;
    justify-content: center;
    align-items: center;
    overflow: hidden;
}

.wireframe {

    &_input {
        position: fixed;
        top: -100%;
        left: -100%;
        visibility: hidden;

        &:checked {
            
            & + .wireframe_label {
                color: chartreuse;
                &::before {
                    background-color: chartreuse;
                }
            }

            & ~ .towerOuter > .tower > .card, & ~ .towerOuter > .tower > .card::after {
                background-image: unset;
                box-shadow: 0 0 1px 1px #fff inset;
            }
        }
    }

    &_label {
        position: fixed;
        top: 0%;
        left: 0%;
        font-size: 20px;
        padding: 0.5em;
        z-index: 3;
        transition: color 0.25s;

        &::before {
            content: '';
            display: inline-block;
            width: 0.75em;
            height: 0.75em;
            margin-right: 0.25em;
            background-color: maroon;
            border-radius: 0.25em;
            border: 2px solid #aaa;
            transition: background-color 0.25s;
        }
    }
}

.hoverPad {
    position: absolute;
    z-index: 2;
    width: 100%;
    height: 10%;

    @for $y from 0 to 10 {
        &:nth-child(#{$y + 3}) {
            top: #{$y * 10%};

            &:hover ~ .towerOuter {
                --perspectivOriginY: #{$y * 5% + 15%};
            }
        }
    }
}

// card vars:
$towerRadius: 210;
$cardWidth: 50;
$cardHeight: 70;
$ringHeight: 33;

.towerOuter {
    position: absolute;
    top: 0; left: 0; right: 0; bottom: 0;
    perspective: 700px;
    perspective-origin: center var(--perspectivOriginY);
    transition: perspective-origin 0.25s;
}

.tower {
    position: absolute;
    top: 50%; left: 50%;;
    width: $cardWidth + px;
    transform-style: preserve-3d;
    animation: towerRotate 60s infinite linear;

    @keyframes towerRotate {
        from { transform: translateX(-50%) rotateY(0deg); }
        to { transform: translateX(-50%) rotateY(360deg); }
    }
}

.card {
    position: absolute;
    width: $cardWidth + px;
    height: $cardHeight + px;
    background-image: url('https://assets.codepen.io/1948355/cardsheet01.jpg');
    background-size: #{$cardWidth * 13}px #{$cardHeight * 4}px;
    border-radius: 8px;
    transform-style: preserve-3d;
    box-shadow: 0 0 10px #0007 inset;
    backface-visibility: hidden;

    @for $r from 0 through 2 {
        @for $i from 1 through 24 {
            &:nth-child(#{$i + $r*72}) {
                background-position: #{random(13) * $cardWidth}px #{random(4) * $cardHeight}px;
                // transform: rotateY(#{($i - 1 + $r * 0.5) * 360 / 24}deg) translateX(#{$towerRadius}px) translateY(#{($r - 1.5) * ($ringHeight * 2)}px) rotateX(#{((random(2) - 1) * 180) - 20}deg);
                transform: rotateY(#{($i - 1 + $r * 0.5) * 360 / 24}deg) translateX(#{$towerRadius}px) translateY(#{($r - 1.5) * ($ringHeight * 2)}px) rotateX(-20deg);
            }
            &:nth-child(#{$i + 24 + $r*72}) {
                background-position: #{random(13) * $cardWidth}px #{random(4) * $cardHeight}px;
                // transform: rotateY(#{($i - 24.5 + $r * 0.5) * 360 / 24}deg) translateX(#{$towerRadius}px) translateY(#{($r - 1.5) * ($ringHeight * 2)}px) rotateX(#{((random(2) - 1) * 180) + 20}deg);
                transform: rotateY(#{($i - 24.5 + $r * 0.5) * 360 / 24}deg) translateX(#{$towerRadius}px) translateY(#{($r - 1.5) * ($ringHeight * 2)}px) rotateX(200deg);
            }
            &:nth-child(#{$i + 48 + $r*72}) {
                background-position: #{random(13) * $cardWidth}px #{random(4) * $cardHeight}px;
                // transform: rotateY(#{($i - 48.75 + $r * 0.5) * 360 / 24}deg) translateX(#{$towerRadius}px) translateY(#{($r - 2) * ($ringHeight * 2)}px) rotateX(#{((random(2) - 1) * 180) - 90}deg);
                transform: rotateY(#{($i - 48.75 + $r * 0.5) * 360 / 24}deg) translateX(#{$towerRadius}px) translateY(#{($r - 2) * ($ringHeight * 2)}px) rotateX(-90deg);
            }
        }
    }

    &::after {
        content: '';
        position: absolute;
        top: 0; left: 0;
        width: $cardWidth + px;
        height: $cardHeight + px;
        transform: rotateY(180deg);
        backface-visibility: hidden;
        background-image: url('https://assets.codepen.io/1948355/cardback01.jpg');
        background-size: #{$cardWidth}px #{$cardHeight}px;
        border: 1px solid #fff7;
        border-radius: 8px;
    }
}

.shadow {
    position: absolute;
    top: 50%; left: 50%;
    transform: translate(-50%, -50%) rotateX(-90deg) translateZ(#{($ringHeight * 3) + 5}px);
    width: #{$towerRadius * 3}px;
    height: #{$towerRadius * 3}px;
    background-image: radial-gradient(#0000, #000 #{$towerRadius}px, #0000 #{$towerRadius * 1.5}px);
}
              
            
!

JS

              
                /*
  Anyone who knows me knows that I (usually) walk around with a deck of cards on me. There's (at least) one pack permanently on my desk, and dozens of old ones on the shelf behind me.
  Yep, I love playing around with cards. But I also love CSS, so I've always wanted to do some kind of combination between the two, and here it is.
  :)
*/
              
            
!
999px

Console