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. 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

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

              
                <!--
HINTS

- .photobox__info - a class including content that will show when users move the mouse on the picture. You can put inside of it text, links, etc.
-->

<div class="page">
  <div class="photobox photobox_flat">
    <div class="photobox__previewbox media-placeholder">
      <img src="https://images.unsplash.com/photo-1543762446-67600aab041f?ixlib=rb-1.2.1&ixid=eyJhcHBfaWQiOjEyMDd9&auto=format&fit=crop&w=751&q=80" class="photobox__preview media-placeholder__media" alt>          
    </div>
    <div class="photobox__info-wrapper">
      <div class="photobox__info"><span>some effect</span></div>
    </div>
  </div>      
  <div class="photobox photobox_flat photobox_scale-sliding">
    <div class="photobox__previewbox media-placeholder">
      <img src="https://images.unsplash.com/photo-1541411780127-15d88bd3476d?ixlib=rb-1.2.1&ixid=eyJhcHBfaWQiOjEyMDd9&auto=format&fit=crop&w=734&q=80" class="photobox__preview media-placeholder__media" alt>          
    </div>
    <div class="photobox__info-wrapper">
      <div class="photobox__info"><span>some effect</span></div>    
    </div>
  </div>
  <div class="photobox photobox_flat photobox_scaled">
    <div class="photobox__previewbox media-placeholder">
      <img src="https://images.unsplash.com/photo-1589837396034-518c01de601a?ixlib=rb-1.2.1&ixid=eyJhcHBfaWQiOjEyMDd9&auto=format&fit=crop&w=750&q=80" class="photobox__preview media-placeholder__media" alt>          
    </div>
    <div class="photobox__info-wrapper">
      <div class="photobox__info"><span>some effect</span></div>    
    </div>
  </div>
  <div class="photobox photobox_flat photobox_scale-rotated">
    <div class="photobox__previewbox media-placeholder">
      <img src="https://images.unsplash.com/photo-1553240799-36bbf332a5c3?ixlib=rb-1.2.1&ixid=eyJhcHBfaWQiOjEyMDd9&auto=format&fit=crop&w=750&q=80" class="photobox__preview media-placeholder__media" alt>          
    </div>
    <div class="photobox__info-wrapper">
      <div class="photobox__info"><span>some effect</span></div>
    </div>
  </div>
  <div class="photobox photobox_rounded">
    <div class="photobox__previewbox media-placeholder">
      <img src="https://images.unsplash.com/photo-1553925994-a05ffc93cf2f?ixlib=rb-1.2.1&ixid=eyJhcHBfaWQiOjEyMDd9&auto=format&fit=crop&w=750&q=80" class="photobox__preview media-placeholder__media" alt>          
    </div>
    <div class="photobox__info-wrapper">
      <div class="photobox__info"><span>some effect</span></div>
    </div>
  </div>
  <div class="photobox photobox_rounded photobox_scale-sliding">
    <div class="photobox__previewbox media-placeholder">
      <img src="https://images.unsplash.com/photo-1599476472821-4a34ce245555?ixlib=rb-1.2.1&ixid=eyJhcHBfaWQiOjEyMDd9&auto=format&fit=crop&w=750&q=80" class="photobox__preview media-placeholder__media" alt>          
    </div>
    <div class="photobox__info-wrapper">
      <div class="photobox__info"><span>some effect</span></div>
    </div>
  </div>
  <div class="photobox photobox_rounded photobox_scaled">
    <div class="photobox__previewbox media-placeholder">
      <img src="https://images.unsplash.com/photo-1595743826997-87eb67a31872?ixlib=rb-1.2.1&ixid=eyJhcHBfaWQiOjEyMDd9&auto=format&fit=crop&w=750&q=80" class="photobox__preview media-placeholder__media" alt>          
    </div>
    <div class="photobox__info-wrapper">
      <div class="photobox__info"><span>some effect</span></div>
    </div>
  </div>
  <div class="photobox photobox_rounded photobox_scale-rotated">
    <div class="photobox__previewbox media-placeholder">
      <img src="https://images.unsplash.com/photo-1562206932-a4bc8615c1f1?ixlib=rb-1.2.1&ixid=eyJhcHBfaWQiOjEyMDd9&auto=format&fit=crop&w=750&q=80" class="photobox__preview media-placeholder__media" alt>          
    </div>
    <div class="photobox__info-wrapper">
      <div class="photobox__info"><span>some effect</span></div>
    </div>
  </div>
  <div class="photobox photobox_triangular">
    <div class="photobox__previewbox media-placeholder">
      <img src="https://images.unsplash.com/photo-1561522026-3598a1e8aa0a?ixlib=rb-1.2.1&ixid=eyJhcHBfaWQiOjEyMDd9&auto=format&fit=crop&w=750&q=80" class="photobox__preview media-placeholder__media" alt>          
    </div>
    <div class="photobox__info-wrapper">
      <div class="photobox__info"><span>some effect</span></div>
    </div>
  </div>
  <div class="photobox photobox_triangular photobox_scale-sliding">
    <div class="photobox__previewbox media-placeholder">
      <img src="https://images.unsplash.com/photo-1545756924-bd346797a9b0?ixlib=rb-1.2.1&ixid=eyJhcHBfaWQiOjEyMDd9&auto=format&fit=crop&w=750&q=80" class="photobox__preview media-placeholder__media" alt>          
    </div>
    <div class="photobox__info-wrapper">
      <div class="photobox__info"><span>some effect</span></div>
    </div>
  </div>
  <div class="photobox photobox_triangular photobox_scaled">
    <div class="photobox__previewbox media-placeholder">
      <img src="https://images.unsplash.com/photo-1576631420746-f7a83fbc8242?ixlib=rb-1.2.1&ixid=eyJhcHBfaWQiOjEyMDd9&auto=format&fit=crop&w=750&q=80" class="photobox__preview media-placeholder__media" alt>          
    </div>
    <div class="photobox__info-wrapper">
      <div class="photobox__info"><span>some effect</span></div>
    </div>
  </div>
  <div class="photobox photobox_triangular photobox_scale-rotated">
    <div class="photobox__previewbox media-placeholder">
      <img src="https://images.unsplash.com/flagged/photo-1570715746836-9ba930d597c4?ixlib=rb-1.2.1&ixid=eyJhcHBfaWQiOjEyMDd9&auto=format&fit=crop&w=750&q=80" class="photobox__preview media-placeholder__media" alt>          
    </div>
    <div class="photobox__info-wrapper">
      <div class="photobox__info"><span>some effect</span></div>
    </div>
  </div>      
</div>  

              
            
!

CSS

              
                
/*
=====
DEPENDENCES
=====
*/

.media-placeholder{
    position: var(--mediaPlaceholderPosition, relative) !important;
}

.media-placeholder::before{
    content: "" !important;
    display: block !important;
    padding-top: var(--mediaPlaceholderRatio) !important;
    background-color: var(--mediaPlaceholderBgColor) !important;
}

.media-placeholder__media{
    position: var(--mediaPlaceholderMediaPosition, absolute) !important;
    top: var(--mediaPlaceholderMediaTop, 0) !important;
    left: var(--mediaPlaceholderMediaLeft, 0) !important;
    max-width: var(--mediaPlaceholderMediaMaxWidth, 100%) !important;
}

/*
=====
CORE STYLES
=====
*/

.photobox{
  --mediaPlaceholderRatio: var(--photoboxPlaceholderRatio, 50%);
  
  display: var(--photoboxDisplay, inline-flex);
  position: var(--photoboxPosition, relative);
}

.photobox__previewbox{
  overflow: hidden;
  width: 100%;
  will-change: transform;
}

.photobox__previewbox::after{
  content: "";
  width: var(--photoboxOverlayWidth, 100%);
  height: var(--photoboxOverlayHeight, 100%);
  background-color: var(--photoboxOverlayBackgroundColor, rgba(0, 0, 0, .8));
  
  position: absolute;
  top: var(--photoboxOverlayTop, 0);
  left: var(--photoboxOverlayLeft, 0);
  z-index: var(--photoboxOverlayZindex, 2); 
}

.photobox__info-wrapper{
  box-sizing: border-box;
  width: 100%;
  height: 100%;
  padding: .25rem;
  
  display: flex;
  
  opacity: 0;  
  transition: opacity .2s ease-out;
  will-change: opacity;
  
  position: absolute;
  top: 0;
  left: 0;
  z-index: var(--photoboxInfoZindex, 2);
}

.photobox__info{
  margin: auto;
}

.photobox:hover .photobox__info-wrapper{
  opacity: 1;
  transition-delay: .3s;
}

/*
flat mask
*/

.photobox_flat .photobox__previewbox::after{
  opacity: 0;
  transition: opacity .4s cubic-bezier(0.71, 0.05, 0.29, 0.9);
  will-change: opacity;
}

.photobox_flat:hover .photobox__previewbox::after{
  opacity: 1;
}

/*
rounded mask
*/

.photobox_rounded{
  --photoboxOverlayWidth: 0;
  --photoboxOverlayHeight: 0;
  --photoboxOverlayTop: 50%;
  --photoboxOverlayLeft: 50%;
}

.photobox_rounded .photobox__previewbox::after{
  padding: 45%;
  border-radius: 50%; 
}

.photobox_rounded .photobox__previewbox::after{
  transition: transform .25s ease;
  will-change: transform;
  transform: translate(-50%, -50%) scale(0);
}

.photobox_rounded:hover .photobox__previewbox::after{
  transform: translate(-50%, -50%) scale(2);
  transition-duration: .8s;
}

/*
triangular mask
*/

.photobox_triangular .photobox__previewbox::after{
  opacity: 0;
  clip-path: polygon(0 100%, 50% 0, 50% 0, 100% 100%);
  transition: clip-path .1s ease-out, opacity .1s ease-out;
  will-change: clip-path;
}

.photobox_triangular:hover .photobox__previewbox::after{
  opacity: 1;
  transition-duration: .4s;
  clip-path: polygon(0 100%, 0 0, 100% 0, 100% 100%);
}

/*
scale-slipping animation
*/

.photobox_scale-sliding .photobox__preview{
	transition: transform .4s cubic-bezier(0.71, 0.05, 0.29, 0.9);
	transform: scale(1) translate(0, 0);
}

.photobox_scale-sliding:hover .photobox__preview{
  transform: scale(1.2) translate(4%, 4%);
}

/*
scale animation
*/

.photobox_scaled .photobox__preview{
	transition: transform .4s cubic-bezier(0.71, 0.05, 0.29, 0.9);
	transform: scale(1);
}

.photobox_scaled:hover .photobox__preview{
  transform: scale(1.2);
}

/* 
scale-rotate animation
*/

.photobox_scale-rotated .photobox__preview{
	transition: transform .4s cubic-bezier(0.71, 0.05, 0.29, 0.9);
	transform: scale(1) rotate(0);
}

.photobox_scale-rotated:hover .photobox__preview{
  transform: scale(1.2) rotate(5deg);
}

/*
=====
SETTINGS
=====
*/

:root{
  --photoboxPlaceholderRatio: 66.56%;
  --photoboxOverlayBackgroundColor: rgba(72, 27, 174, .7);
}

/*
=====
DEMO
=====
*/

body{
  font-family: -apple-system, BlinkMacSystemFont, Segoe UI, Roboto, Open Sans, Ubuntu, Fira Sans, Helvetica Neue, sans-serif;
  margin: 0;
}

.page{
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(19rem, 1fr));
}

.photobox{
  color: #fff;
  font-size: 1.25rem;
  font-weight: 700;  
}
              
            
!

JS

              
                
              
            
!
999px

Console