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

              
                <!-- 

All of this magic runs on hover events using the CSS :hover pseudo-class. The animated overlays are built with CSS3 transitions.

-->

<div id="container">
  
  <!-- Left to Right transition -->
  <div class="row">
    <div class="image_wrapper">
      <img src="http://placehold.it/200x250" />
      <div class="overlay left">		Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat.</div>
    </div>
    <div class="image_wrapper">
      <img src="http://placehold.it/200x250" />
      <div class="overlay left"></div>
    </div>
    <div class="image_wrapper">
      <img src="http://placehold.it/200x250" />
      <div class="overlay left"></div>
    </div>
  </div>
  
  <!-- Bottom to Top Transition -->
  <div class="row">
    <div class="image_wrapper">
      <img src="http://placehold.it/200x250" />
      <div class="overlay bottom_full">	Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat.</div>
    </div>
    <div class="image_wrapper">
      <img src="http://placehold.it/200x250" />
      <div class="overlay bottom_full"></div>
    </div>
    <div class="image_wrapper">
      <img src="http://placehold.it/200x250" />
      <div class="overlay bottom_full"></div>
    </div>
  </div>
  
  <!-- Bottom to Halfway up Top Transition -->
  <div class="row">
    <div class="image_wrapper">
      <img src="http://placehold.it/200x250" />
      <!-- This content will be scrollable! Check the CSS -->
      <div class="overlay bottom_half">	Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. 	Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. 	Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat.</div>
    </div>
    <div class="image_wrapper">
      <img src="http://placehold.it/200x250" />
      <div class="overlay bottom_half"></div>
    </div>
    <div class="image_wrapper">
      <img src="http://placehold.it/200x250" />
      <div class="overlay bottom_half"></div>
    </div>
  </div>
  
  <!-- Left to Right & 180 Rotation -->
  <div class="row">
    <div class="image_wrapper">
      <img src="http://placehold.it/200x250" />
      <div class="overlay left half_rotation_cw">	Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat.</div>
    </div>
    <div class="image_wrapper">
      <img src="http://placehold.it/200x250" />
      <div class="overlay left half_rotation_cw"></div>
    </div>
    <div class="image_wrapper">
      <img src="http://placehold.it/200x250" />
      <div class="overlay left half_rotation_cw"></div>
    </div>
  </div>
  
  <!-- Grow and Shrink From Center -->
  <div class="row">
    <div class="image_wrapper">
      <img src="http://placehold.it/200x250" />
      <div class="overlay center grow">	Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat.</div>
    </div>
    <div class="image_wrapper">
      <img src="http://placehold.it/200x250" />
      <div class="overlay center grow"></div>
    </div>
    <div class="image_wrapper">
      <img src="http://placehold.it/200x250" />
      <div class="overlay center grow"></div>
    </div>
  </div>
  
  <!-- Fade one image to another -->
  <div class="row">
    <div class="image_wrapper">
      <img class="top_image" src="http://www.placecage.com/200/250" />
      <img class="bottom_image" src="http://www.placecage.com/c/200/250" />
    </div>
    <div class="image_wrapper">
      <img class="top_image" src="http://www.fillmurray.com/200/250" />
      <img class="bottom_image" src="http://www.fillmurray.com/g/200/250" />
    </div>
    <div class="image_wrapper">
      <img class="top_image" src="http://www.nicenicejpg.com/200/250" />
      <img class="bottom_image" src="http://www.nicenicejpg.com/5.0/200/250" />
    </div>
  </div>
  
</div>
              
            
!

CSS

              
                .row {
  margin: 20px;
}
.row::after {
  content: '';
  clear: both;
}

.image_wrapper {
  display: inline-block;
  position: relative; /* give position relative so child elements .overlay can be positioned absolutely */
  height: 250px; /* to match the image height */
}

.overlay {
  position: absolute; /* absolute positioning so we can overlay the element on top of .image_wrapper */
  overflow: hidden; /* Hide any text/content within the <div> that might "overflow" */
   background-color: rgba(0,0,0,0.7); /* black color (0,0,0) with a 0.7 opacity */
  color: #fff;
  font-weight: bold;
}

.overlay.left {
  top: 0;
  left: 0;
  width: 0;
  height: 100%;
  transition: width 0.3s ease-in-out /* we will change width to 100% later */
}

.overlay.bottom_full {
  bottom: 0;
  left: 0;
  width: 100%;
  height: 0;
  transition: height 0.3s ease-in-out /* we will change height to 100% later */
}

.overlay.bottom_half {
  bottom: 0;
  left: 0;
  width: 100%;
  height: 0;
  overflow-y: hidden; /* hide text... adding here so we can transition it later */
  transition: height 0.3s ease-in-out , overflow 0.3s ease-in-out;
  /* we will change height to 50% later and change overflow to visible */
}

.overlay.center {
  top: 0;
}

.overlay.grow {
  width: 100%; 
  height: 100%; 
  transform: scale(0); /* we will change to 1 later */
  transition: transform 0.4s ease-in-out; 
}

.overlay.half_rotation_cw {
  transform: rotate(-180deg); /* so when the content rotates in the transition, it isn't upside down! */
}

.image_wrapper:hover > .overlay.left {
  width: 100%;
}

.image_wrapper:hover > .overlay.bottom_full {
  height: 100%;
}

.image_wrapper:hover > .overlay.bottom_half {
  height: 50%;
  overflow-y: auto;
}

.image_wrapper:hover > .overlay.half_rotation_cw {
  transform: rotate(0); /* rotate back to normal orientation (upside down before transitioned) */
  transition: transform 0.4s ease-in, width 0.3s ease-in-out; /* transition width, but also got rotation on ease-in */
}

.image_wrapper:hover > .overlay.grow {
  transform: scale(1);
}

.image_wrapper .top_image {
  opacity: 1;
  transition: opacity 0.6s ease-in-out;
}
.image_wrapper .bottom_image {
  position: absolute;
  top: 0;
  left: 0;
  opacity: 0;
  transition: opacity 0.6s ease-in-out;
}
.image_wrapper:hover > .top_image {
  opacity: 0;
}
.image_wrapper:hover > .bottom_image {
  opacity: 1;
}

              
            
!

JS

              
                
              
            
!
999px

Console