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. You can use the CSS from another Pen by using it's URL and the proper URL extention.

+ 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

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.cards
    for i in [1, 2, 3, 4, 5, 6, 7, 8, 9]
        div.card
            div.card-front
                h2.card-title Card Title
            div.card-back
                div.card-back-wrapper
                    p Lorem ipsum dolor sit amet, consectetur adipisicing elit. Tempora nesciunt quod dolores aliquid repudiandae ipsa recusandae quam dolore, repellendus eligendi dignissimos voluptas iure sunt atque odio, cupiditate necessitatibus, fugiat iusto quisquam esse omnis laborum facere. Temporibus natus animi tempore. Labore!
              
            
!

CSS

              
                $nb-cards: 9;
$nb-columns: 3;
$nb-rows: ceil($nb-cards / $nb-columns);
$transition-duration: 300ms;

$images: (
    "http://lorempixel.com/600/800/nature",
    "http://lorempixel.com/600/800/sports",
    "http://lorempixel.com/600/800/city",
    "http://lorempixel.com/600/800/business",
    "http://lorempixel.com/600/800/technics",
    "http://lorempixel.com/620/800/city",
    "http://lorempixel.com/620/800/nature",
    "http://lorempixel.com/620/800/business",
    "http://lorempixel.com/620/800/sports"
);

body {
    background-color: #1d1f20;
    -webkit-transform: translate3d(0,0,0);
}

.cards {
    width: 100%;
    height: 100vh;
    font-size: 0;
    &:hover {
        .card {
            opacity: 0.3;
            filter: grayscale(100%);
            &:hover,
            &.is-active {
                opacity: 1;
                filter: none;
            }
        }
    }
}

.card {
    display: inline-block;
    vertical-align: middle;
    position: absolute;
    overflow: hidden;
    width: 100% / $nb-columns;
    height: 100% / $nb-rows;
    cursor: pointer;
    transition: all $transition-duration linear, opacity 300ms linear, filter 300ms linear;
    &.is-active {
        z-index: 1;
        top: 0 !important;
        left: 0 !important;
        width: 100%;
        height: 100%;
        opacity: 1;
        transform: rotateY(180deg);
        filter: none;
        .card-front {
            opacity: 0;
            filter: none;
        }
        .card-back,
        .card-back-wrapper {
            opacity: 1;
        }
        .card-back-wrapper {
            transition: opacity 300ms $transition-duration linear;
        }
    }
}

.card-front,
.card-back {
    width: 100%;
    height: 100%;
    transition: all 0ms $transition-duration * 0.5 linear;
}

.card-front {
    background-position: center;
    background-size: cover;
}

.card-back {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    opacity: 0;
    background-color: darken(#1d1f20, 5%);
    p {
        position: absolute;
        top: 50%;
        left: 50%;
        margin: 0;
        font-size: 24px;
        color: #fff;
        transform: translate(-50%, -50%);
    }
}

.card-back-wrapper {
    position: relative;
    width: 100%;
    height: 100%;
    opacity: 0;
    transition: opacity 100ms 0ms;
    transform: rotateY(180deg);
}

@function str-repeat($string, $times) {
    $result: "";
    @for $i from 1 through $times {
        $result: $result + $string;
    }
    @return $result;
}

@for $index from 1 through $nb-cards {
    @if ($index - 1) % $nb-columns == 0 {
        .card:nth-child(#{$index}) {
            top: 100% / $nb-rows * (($index - 1) / $nb-columns);
            @if $nb-columns - 1 > 0 {
                @for $i from 1 through $nb-columns - 1 {
                    #{str-repeat("+ .card", $i)} {
                        top: 100% / $nb-rows * (($index - 1) / $nb-columns);
                    }
                }
            }
        }
    }
    .card:nth-child(#{$index}) {
        left: 100% / $nb-columns * (($index - 1) % $nb-columns);
    }
    .card:nth-child(#{$index}) .card-front {
        background-image: url(#{nth($images, $index)});
    }
}
              
            
!

JS

              
                $('.card').on('click', function() {
    $(this).toggleClass('is-active');
});
              
            
!
999px

Console