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

              
                <body>
    <main class="main">
        <div class="signup-section">
            <div class="signup-box">
                <h1 class="main-heading">
                    Grab your Showbox!
                </h1>
                <p class="body-text">
                    Get the latest information and details on our brand new streaming movies platform!
                </p>
                <button class="signup-button">
                    Sign up today
                </button>
            </div>
        </div>
        <div class="cube__section">
            <div class="cube">
                <div class="cube__container">
                    <div class="cube__face cube__face--front">
                        <video class="video__container" autoplay muted loop>
                            <source class="video__media" src="https://storage.coverr.co/videos/KP78n9EWQAje1fm6Xr02N6zm7V01xxNRNK?token=eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJhcHBJZCI6IjExNDMyN0NEOTRCMUFCMTFERTE3IiwiaWF0IjoxNTg4MDIwODIzfQ._d_wNMzyykNR9_7lkgCpidj0JI4vCGuxfDKyEEfStO0" type="video/mp4">
                        </video>
                    </div>
                    <div class="cube__face cube__face--back">
                        <video class="video__container" autoplay muted loop>
                            <source class="video__media" src="https://storage.coverr.co/videos/KefsniMdijw4at9fT02iUufbPceUuJJG2?token=eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJhcHBJZCI6IjExNDMyN0NEOTRCMUFCMTFERTE3IiwiaWF0IjoxNTg4MDIwNjcxfQ.3kzxKS0a6bQ2dCcKpTxeZS2IpVfUekVpMFrBzpBwA2M" type="video/mp4">
                        </video>
                    </div>
                    <div class="cube__face cube__face--left">
                        <video class="video__container" autoplay muted loop>
                            <source class="video__media" src="https://storage.coverr.co/videos/34w86e7pqJzbji1yJ4gmfSanA01bjPyH7?token=eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJhcHBJZCI6IjExNDMyN0NEOTRCMUFCMTFERTE3IiwiaWF0IjoxNTg4MDIwNzYxfQ.xUJhNmkTYbzdHfVJsvVrtB4RFbn0cwaA7DRg9rEvMyU" type="video/mp4">
                        </video>
                    </div>
                    <div class="cube__face cube__face--right">
                        <video class="video__container" autoplay muted loop>
                            <source class="video__media" src="https://storage.coverr.co/videos/8GSSdF02KLFPJQgkILrDCkRfHHuouBMVA?token=eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJhcHBJZCI6IjExNDMyN0NEOTRCMUFCMTFERTE3IiwiaWF0IjoxNTg4MDIxMDMzfQ.Wk1guDwsEY_-Y1K8vo5FkU3GhutfkMA8PPxj4Afv5_w" type="video/mp4">
                        </video>
                    </div>
                    <div class="cube__face cube__face--top">
                        <video class="video__container" autoplay muted loop>
                            <source class="video__media" src="https://storage.coverr.co/videos/EZvZIdsvOkc00V02BDw3ZnH4VdoJK01qSsS?token=eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJhcHBJZCI6IjExNDMyN0NEOTRCMUFCMTFERTE3IiwiaWF0IjoxNTg4MDIxMTE4fQ.u6UFXCGSK755PtJtWoDAuFkasaQ7Tb2SbIXEGhFr4iw" type="video/mp4">
                        </video>
                    </div>
                    <div class="cube__face cube__face--bottom">
                        <video class="video__container" autoplay muted loop>
                            <source class="video__media" src="https://storage.coverr.co/videos/Vcve11Kp8bptZ00n1nsBEOh02qF5fgShYW?token=eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJhcHBJZCI6IjExNDMyN0NEOTRCMUFCMTFERTE3IiwiaWF0IjoxNTg4MDIwNDgwfQ.eI4Ak0fYiUzCRoLs2VdJZLea9e-zrjzJJ6RN1OFSim4" type="video/mp4">
                        </video>
                    </div>
                </div>
            </div>
        </div>
    </main>
</body>
              
            
!

CSS

              
                /* CSS reset ==============================================*/
*,
*::after,
*::before {
  box-sizing: inherit;
  margin: 0;
  padding: 0;
}

body {
  box-sizing: border-box;
  position: relative;
}

html {
  /* formula: 1 rem = 10px; 10px/16px = 62.5% */
  font-size: 62.5%;
}

/* Typography ================================================*/

* {
  color: #eee;
  font-family: "Open Sans", sans-serif;
}

/* Signup heading */
.main-heading {
  font-size: 3.5rem;
  padding-bottom: 2rem;
  width: 40rem;
}

/* Signup text */
.body-text {
  color: #eee;
  font-family: "Open Sans", sans-serif;
  font-size: 1.4rem;
  font-weight: 300;
  line-height: 2rem;
  padding-bottom: 3rem;
}

/* Components ================================================*/

/* Signup button */
.signup-button {
  background-color: transparent;
  border: 2px solid #eee;
  border-radius: 0.5rem;
  color: #eee;
  font-size: 1.5rem;
  overflow: hidden;
  padding: 1rem 2rem;
  position: relative;
  transition: all 0.2s ease-in-out;
  z-index: 10;
}

.signup-button:hover {
  color: #272829;
}

.signup-button::before {
  background-color: #eee;
  content: "";
  height: 100%;
  left: 0;
  position: absolute;
  top: 0;
  transform: scaleX(0);
  transition: all 0.2s ease-in-out;
  width: 100%;
  z-index: -1;
}

.signup-button:hover::before {
  transform: scaleX(1);
}

/* Layout ================================================*/

.main {
  align-items: center;
  background: linear-gradient(to right bottom, #272829, #37383b, #272829);
  display: flex;
  flex-direction: row;
  height: 100vh;
  position: relative;
  width: 100%;
}

/* Signup section (on left side) */
.signup-section {
  align-items: center;
  display: flex;
  flex-direction: column;
  height: 100%;
  margin-left: 4rem;
  justify-content: center;
  width: 45%;
}

/* Container for heading, text, and button  */
.signup-box {
  width: 100%;
  height: 55%;
}

/* Showbox cube section (on right side) */
.cube__section {
  align-items: center;
  display: flex;
  height: 100vh;
  justify-content: center;
  width: 60%;
}

/* The cube - where the fun begins :) ===========================*/

/* The cube outer container */
.cube {
  height: 20rem;
  perspective: 60rem;
  width: 20rem;
}

/* The cube's inner container */
/* Note: rotationBox keyframes is placed right at the end */
.cube__container {
  animation: rotationBox 20s linear infinite forwards;
  height: 100%;
  position: relative;
  transform: translateZ(-10rem);
  transform-style: preserve-3d;
  width: 100%;
}

/* This will target every single side of the cubez */
.cube__face {
  align-items: center;
  background-color: #eee;
  display: flex;
  height: 20rem;
  justify-content: center;
  overflow: hidden;
  position: absolute;
  width: 20rem;
}

/* This will target an individual side of the cube */
.cube__face--front {
  transform: rotateY(0deg) translateZ(10rem);
}
.cube__face--back {
  transform: rotateY(180deg) translateZ(10rem);
}
.cube__face--left {
  transform: rotateY(-90deg) translateZ(10rem);
}
.cube__face--right {
  transform: rotateY(90deg) translateZ(10rem);
}
.cube__face--top {
  transform: rotateX(90deg) translateZ(10rem);
}
.cube__face--bottom {
  transform: rotateX(-90deg) translateZ(10rem);
}

/* Videos ==============================================================*/

/* Specifically targeting the <video> element */
.video__container {
  height: auto;
  min-height: 100%;
  object-fit: cover;
  width: 100%;
}

/* Responsive ============================================================*/

/* Tablet */
@media only screen and (max-width: 48em) {
  /* CSS Reset */

  html {
    font-size: 56.25%;
  }

  /* Typography */

  /* Signup heading */
  .main-heading {
    width: 100%;
  }

  /* Layout */

  .main {
    flex-direction: column-reverse;
    height: 100%;
  }

  /* Signup section (on left side) */
  .signup-section {
    height: 100%;
    margin-left: 0;
    width: 100%;
  }

  /* Container for heading, text, and button  */
  .signup-box {
    height: 100%;
    padding: 3rem 2rem;
    text-align: center;
  }

  /* Showbox cube section (on right side) */
  .cube__section {
    height: 100vh;
    width: 100%;
  }
}

/* Mobile */
@media only screen and (max-width: 22.5em) {
  /* Typography */

  /* Signup text */
  .body-text {
    font-size: 1.8rem;
    line-height: 2.8rem;
  }

  /* Layout */

  /* Signup section (on left side) */
  .signup-section {
    height: 100%;
    margin-left: 0;
    width: 100%;
  }

  /* Container for heading, text, and button  */
  .signup-box {
    height: 100%;
    padding: 3rem;
    padding-top: 1rem;
    text-align: center;
  }

  /* Showbox cube section (on right side) */
  .cube__section {
    height: 60vh;
    width: 100%;
  }

  /* The cube outer container */
  .cube {
    height: 15rem;
    perspective: 60rem;
    width: 15rem;
  }

  /* The cube's inner container */
  .cube__container {
    transform: translateZ(-7.5rem);
  }

  /* This will target every single side of the cubes */
  .cube__face {
    height: 15rem;
    width: 15rem;
  }

  /* This will target an individual side of the cube */
  .cube__face--front {
    transform: rotateY(0deg) translateZ(7.5rem);
  }
  .cube__face--back {
    transform: rotateY(180deg) translateZ(7.5rem);
  }
  .cube__face--left {
    transform: rotateY(-90deg) translateZ(7.5rem);
  }
  .cube__face--right {
    transform: rotateY(90deg) translateZ(7.5rem);
  }
  .cube__face--top {
    transform: rotateX(90deg) translateZ(7.5rem);
  }
  .cube__face--bottom {
    transform: rotateX(-90deg) translateZ(7.5rem);
  }
}

/* Animation ============================================================*/

@keyframes rotationBox {
  0% {
    transform: rotate3d(0, 0, 0, 0deg);
  }
  25% {
    transform: rotate3d(0, 1, 1, 90deg);
  }
  50% {
    transform: rotate3d(1, 0, 1, 180deg);
  }
  75% {
    transform: rotate3d(1, 1, 0, 240deg);
  }
  100% {
    transform: rotate3d(1, 1, 1, 360deg);
  }
}

              
            
!

JS

              
                // Showbox

// Showcasing a rotating 3D cube covered with videos for signup page of a fictional streaming movies service

// My original aim was to create a 3D cube that rotates slightly on hover. However, once I have achieved that goal, I have decided to take it further to the next level by having the cube rotating in different directions at all time, and each cube face will have a  video placed across its surface. 

// UPDATE: It is now responsive tp

              
            
!
999px

Console