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 class="generic"></div>
    <div class="mbg bg bgimg"></div>
    <div class="ibg bg bgimg"></div>
    <div class="gbg bg bgimg"></div>
    <div class="backgrounds" onclick="noSpin()"></div>
    <div class="card-wrap center">
        <div onclick="spin(this)" class="card card-1">
            <div class="inner">
                <div class="front">
                    <h1>THE MARTIAN</h1>
                    <img src="https://connorlaw.co.uk/images/Martian-front.png" alt="Martian">
                </div>
                <div class="back">
                   <div class="back-info center">
                    <H2 class="m">THE MARTIAN</H2>
                    <p class="blurb">When astronauts blast off from the planet Mars, they leave behind Mark Watney (Matt Damon), presumed dead after a fierce storm. With only a meager amount of supplies, the stranded visitor must utilize his wits and spirit to find a way to survive on the hostile planet.<br><br>Meanwhile, back on Earth, members of NASA and a team of international scientists work tirelessly to bring him home, while his crew mates hatch their own plan for a daring rescue mission.</p>
                    </div>
                    <div class="back-buttons">
                           <h4>Play Now</h4>
                           <h4>Download</h4>
                           <h4>Add To List</h4>
                       </div>
                    <img src="https://connorlaw.co.uk/images/Martian-Back.png" alt="Martian">
                </div>
            </div>
        </div><div onclick="spin(this)" class="card card-2">
            <div class="inner">
                <div class="front">
                    <h1>INTERSTELLAR</h1>
                    <img src="https://connorlaw.co.uk/images/Interstellar-front.png" alt="Interstellar">
                </div>
                <div class="back">
                   <div class="back-info center">
                    <H2 class="i">INTERSTELLAR</H2>
                       <p class="blurb ">In Earth's future, a global crop blight and second Dust Bowl are slowly rendering the planet uninhabitable. Professor Brand (Michael Caine), a brilliant NASA physicist, is working on plans to save mankind by transporting Earth's population to a new home via a wormhole.<br><br>But first, Brand must send former NASA pilot Cooper (Matthew McConaughey) and a team of researchers through the wormhole and across the galaxy to find out which of three planets could be mankind's new home.</p></div>
                       <div class="back-buttons">
                           <h4>Play Now</h4>
                           <h4>Download</h4>
                           <h4>Add To List</h4>
                       </div>
                    <img src="https://connorlaw.co.uk/images/Interstellar-Back.png" alt="Martian">
                </div>
            </div>
        </div><div onclick="spin(this)" class="card">
            <div class="inner">
                <div class="front">
                    <h1>GRAVITY</h1>
                    <img src="https://connorlaw.co.uk/images/Gravity-front.png" alt="Gravity">
                </div>
                <div class="back">
                  <div class="back-info center">
                   <H2 class="g">GRAVITY</H2>
                      <p class="blurb ">Dr. Ryan Stone (Sandra Bullock) is a medical engineer on her first shuttle mission. Her commander is veteran astronaut Matt Kowalsky (George Clooney), helming his last flight before retirement.<br><br>Then, during a routine space walk by the pair, disaster strikes: The shuttle is destroyed, leaving Ryan and Matt stranded in deep space with no link to Earth and no hope of rescue. As fear turns to panic, they realize that the only way home may be to venture further into space.</p></div>
                      <div class="back-buttons">
                           <h4>Play Now</h4>
                           <h4>Download</h4>
                           <h4>Add To List</h4>
                       </div>
                    <img src="https://connorlaw.co.uk/images/Gravity-Back.png" alt="Martian">
                </div>
            </div>
        </div>
    </div>
              
            
!

CSS

              
                * {
    margin: 0 auto;
}

body {
    height: 100vh;
    background-image: url(https://connorlaw.co.uk/images/earth.jpg);
  background-repeat: no-repeat;
}

.center {
    position: absolute;
    top: 0;
    bottom: 0;
    left: 0;
    right: 0;
    margin: auto;
}

.bg {
    background-repeat: no-repeat;
    background-position: center;
    background-size: cover;
    height: 100vh;
    width: 100%;
    overflow: hidden;
}

.bgimg {
    opacity: 0;
    transition: 0.6s;
}

h1 {
    font-family: 'Big Shoulders Text', cursive;
    position: absolute;
    width: 100%;
    top: 83%;
    opacity: 0.4;
    right: 15px;
    text-align: right;
    letter-spacing: 1px;
}

.blurb {
    font-family: 'Lato', sans-serif;
    letter-spacing: 0.15px;
    width: 300px;
    height: fit-content;
    text-align: center;
    padding: 0rem 1rem;
    box-sizing: border-box;
    font-weight: 300;
    font-size: 14px;
    bottom: 50px;
}

.back h2 {
    width: 300px;
    top: 30px;
    letter-spacing: 4px;
    text-align: center;
    font-size: 30px;
    margin-bottom: 50px;
}

.back-info {
    height: fit-content;
}

.back-buttons {
    font-family: 'Lato', sans-serif;
    letter-spacing: 0.15px;
    font-size: 10px;
    position: absolute;
    left: 45px;
    bottom: -6px;
}

h4 {
    margin-bottom: 23px
}

.m {
    font-family: 'Work Sans', sans-serif;
}

.i {
    font-family: 'Arapey', serif;
}

.g {
    font-family: 'Poppins', sans-serif;
}

.backgrounds {
    height: 100vh;
    width: 100vw;
    background-color: white;
    opacity: 0;
    position: absolute;
}

.mbg {
    background-image: url(https://connorlaw.co.uk/images/martian-bg.png);
    position: absolute;
}

.ibg {
    background-image: url(https://connorlaw.co.uk/images/interstellar-bg.png);
    position: absolute;
}

.gbg {
    background-image: url(https://connorlaw.co.uk/images/gravity-bg.jpg);
    position: absolute;
}

.card-wrap {
    width: fit-content;
    height: 80vh;
}

.card {
    width: 300px;
    height: 80vh;
    perspective: 1000px;
    position: relative;
    display: inline-block;
    margin: 0 5vh;
    transition: 0.6s;
    cursor: pointer;
}

.card:hover {
    transform: scale(1.05);
}

.inner {
    position: absolute;
    width: 100%;
    height: 100%;
    transition: transform 1.4s;
    transform-style: preserve-3d;
}

.spin .inner {
    transform: rotateY(-180deg) scale(1.1);
}

.front, .back {
    position: absolute;
    backface-visibility: hidden;
    width: 300px;
    height: 600px;
    color: #fff;
}

img {
    width: 100%;
    height: 100%;
    border-radius: 20px;
}

.back {
    transform: rotateY(-180deg);
}
              
            
!

JS

              
                let bgs = document.getElementsByClassName("bgimg");
function spin(card) {
    noSpin();
    card.classList.add("spin");
    if (card.classList.contains("card-1")) {
        bgs[0].style.opacity = 1;
    } else if (card.classList.contains("card-2")) {
        bgs[1].style.opacity = 1;
    } else if (card.classList.contains("card-3")) {
        bgs[2].style.opacity = 1;
    };
};

function noSpin() {
    let cards = document.getElementsByClassName("card");
    for (let i = 0; i < cards.length; i++) {
        cards[i].classList.remove("spin");
    };
    for (let i = 0; i < bgs.length; i++) {
        bgs[i].style.opacity = 0;
    };
};

              
            
!
999px

Console