css Audio - Active file-generic CSS - Active Generic - Active HTML - Active JS - Active SVG - Active Text - Active file-generic Video - Active header Love html icon-new-collection icon-person icon-team numbered-list123 pop-out spinner split-screen star tv

Pen Settings

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

You're using npm packages, so we've auto-selected Babel for you here, which we require to process imports and make it all work. If you need to use a different JavaScript preprocessor, remove the packages in the npm tab.

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

Use npm Packages

We can make npm packages available for you to use in your JavaScript. We use webpack to prepare them and make them available to import. We'll also process your JavaScript with Babel.

⚠️ This feature can only be used by logged in users.

Code Indentation


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.

HTML Settings

Here you can Sed posuere consectetur est at lobortis. Donec ullamcorper nulla non metus auctor fringilla. Maecenas sed diam eget risus varius blandit sit amet non magna. Donec id elit non mi porta gravida at eget metus. Praesent commodo cursus magna, vel scelerisque nisl consectetur et.

              - var lipsum = ['Lorem ipsum dolor sit amet, consectetur adipisicing elit.', 'Autem possimus perspiciatis, eaque quos repudiandae modi labore sed repellat dolorum magnam praesentium expedita esse tempore saepe nulla.','Quam molestiae ipsa sapiente mollitia, nobis.', 'Facere illo pariatur necessitatibus fugit quo impedit, quae, corporis placeat recusandae dolor ipsa nobis!', 'Doloremque quisquam molestias, est laudantium vero aliquid dolorum inventore atque sint perferendis qui dolor voluptas consequuntur non.' , 'Veritatis eos similique eveniet tempora.', 'Voluptates impedit dolore eum nisi quas, velit, iste aut labore recusandae temporibus provident distinctio molestias culpa iusto!', 'Ipsam incidunt assumenda hic veritatis odio mollitia, tempora, aut quo nam quisquam officia consequatur aspernatur.'];

h1 Hover around the boxes below

- var rows = 4;
  while rows--
      - var cols = Math.floor(Math.random() * 6 + 1);
      while cols--
        - var photo = Math.floor(Math.random() * 300);
          .photo-container(style="background-image:url(https://source.unsplash.com/600x250/?sig=" + photo + ");")
          h2 Image #{photo} 
            p #{lipsum[cols]}
              /* The magic */
.col {
  // Prepare for absolute slide
  overflow: hidden;
  position: relative;

.slide {
  // Position inside column
  position: absolute;
  top: 0; right: 0; bottom: 0; left: 0;
    Visibility delay gives the previously hovered element time to slide out before disappearing.
    Remove the `visibility` transition to slide in current element without sliding out previous element
  $speed: 0.275s;
  transition: all $speed ease-in-out, visibility 0s $speed;
  visibility: hidden;
  will-change: transform;
  // Slides start below their columns, giving upward motion on hover
  transform: translateY(100%);

.row:hover {
  // Next row, slides are above their columns, giving downward motion on hover
  & ~ .row .slide { transform: translateY(-100%); }
  // Current row, slides to the right of their columns, giving left motion on hover
  .slide { transform: translateX(100%); }
  // Current row, next slides, slides to the left of their columns, giving right motion on hover
  & .col:hover ~ .col .slide { transform: translateX(-100%); }
  // Current slide
  .col:hover .slide {
    transform: none;
    visibility: visible;
    transition-delay: 0s;

/* Pen styling */
// This a mess, ignore

* { box-sizing: border-box; }

body {
  background: #fefefe;  
  color: #333;
  font: 14px /1.5 "Fira Sans", sans-serif;

h1 {
  font-size: 2.5rem;
  font-weight: 300;
  margin: 1.5em 0.5rem 1em;
  text-align: center;

.container {
  margin: 0 auto;
  padding: 2rem;
  max-width: 1200px;

.row { 
  display: flex;

.col {
  color: #fff;
  flex: 1 1 auto;
  min-height: 260px;
  position: relative;
  h2 { 
    font-weight: 300;
    font-size: (14 * 1.33333) / 14 * 1rem;
    line-height: 1.25;
    margin: 0;
    position: absolute;
    bottom: 1.5rem; right: 1.5rem;
    z-index: 0;

// Some size difference for variety
.col:nth-child(2) { min-width: 20%; }
.col:nth-child(4) { min-width: 33%; }
.col:nth-child(3) + .col:nth-child(3) { min-width: 50%; }

// Photo is in its own container, so we can zoom it
.photo-container {
  background: #0f0523 50% 50% / cover;
  position: absolute;
  top: 0; right: 0; bottom: 0; left: 0;
  transition: 1s;
  transform-origin: bottom right;
  &::before {
    background: linear-gradient(transparent, rgba(#431133, 0.5), #000320);
    content: '';
    position: absolute;
    top: 0; right: 0; bottom: 0; left: 0;
  .col:hover & {
    transform: scale(1.25);

// Basic slide styles
.slide {
  background: rgba(#190115, 0.8);
  padding: 0 1.5rem;
🕑 One or more of the npm packages you are using needs to be built. You're the first person to ever need it! We're building it right now and your preview will start updating again when it's ready.
Loading ..................