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

              
                .gallery-wrap.row.center-xs
  %h1 Image gallery hover styles
  .col-xs-5
    %figure.evoc-img
      %img{:class => "", :src => "https://c1.staticflickr.com/8/7119/7132708473_12d8122f6c_h.jpg", :alt => "Nice Flickr image"}
      %figcaption
        %a{:class => "overlay", :href => "https://evochro.me"}
        .fig-text
          %h3 Overlay
          %span.title-add default
          %p The road was long and lonely, so Steve had some songs to sing along to.
  .col-xs-offset-1
  .col-xs-5
    %figure.evoc-img
      %img{:class => "zoom more",:src => "https://c1.staticflickr.com/8/7119/7132708473_12d8122f6c_h.jpg", :alt => "Nice Flickr image"}
      %figcaption
        %a{:class => "overlay", :href => "https://evochro.me"}
        .fig-text
          %h3 Overlay
          %span.title-add zoom
          %p If you look real closely, the road isn't as long as it seems. Maybe just zoom a bit. Add class .more for even more zoom!
          %pre
            %code{} .zoom.more
  
  // IMAGE TRANSITIONS
  %h2 More image Transitions
  .col-xs-5
    %figure.evoc-img
      %img{:class => "left-swipe", :src => "https://c1.staticflickr.com/8/7119/7132708473_12d8122f6c_h.jpg", :alt => "Nice Flickr image"}
      %figcaption
        %a{:class => "overlay", :href => "https://evochro.me"}
        .fig-text
          %h3 Overlay
          %span.title-add image-swipe
          %p Also: top-,bottom- and right-. You can even add them together for more funkyness.
          %pre
            %code{} .right-swipe
  .col-xs-offset-1
  .col-xs-5
    %figure.evoc-img
      %img{:class => "text-bottom-swipe",:src => "https://c1.staticflickr.com/8/7119/7132708473_12d8122f6c_h.jpg", :alt => "Nice Flickr image"}
      %figcaption
        %a{:class => "overlay", :href => "https://evochro.me"}
        .fig-text
          %h3 Overlay
          %span.title-add text-swipe
          %p Swipe text from any corner. Example class:
          %pre
            %code{} .text-bottom-swipe
  .col-xs-5.padded
    %figure.evoc-img
      %img{:class => "top-swipe", :src => "https://c1.staticflickr.com/8/7119/7132708473_12d8122f6c_h.jpg", :alt => "Nice Flickr image"}
      %figcaption
        %a{:class => "overlay", :href => "https://evochro.me"}
        .fig-text
          %h3 Overlay
          %span.title-add top-swipe
          %p Shift the image from top to bottom
  .col-xs-offset-1
  .col-xs-5.padded
    %figure.evoc-img
      %img{:class => "bottom-swipe right-swipe",:src => "https://c1.staticflickr.com/8/7119/7132708473_12d8122f6c_h.jpg", :alt => "Nice Flickr image"}
      %figcaption
        %a{:class => "overlay", :href => "https://evochro.me"}
        .fig-text
          %h3 Overlay
          %span.title-add bottom-swipe + right-swipe
          %p Swipe from bottom to top but take a touristic tour.
          
          
  // ADDING ICONS        
  %h2 Adding Icons
  .col-xs-9
    %figure.evoc-img
      %img{:class => "zoom",:src => "https://c1.staticflickr.com/8/7855/46031064054_23fa7ef916_k.jpg", :alt => "Nice Flickr image"}
      %figcaption
        .overlay.icons
          %a{:class => "icon", :href => "https://facebook.com"}
            %i.fa.fa-facebook-square
            Facebook
          %a{:class => "icon", :href => "https://linkedin.com"}
            %i.fa.fa-linkedin-square
            LinkedIn
          %a{:class => "icon", :href => "https://github.com"}
            %i.fa.fa-github-square
            Github
        .fig-text
          %h3 Icons
          %span.title-add default
          %p Such beautiful mountains, such wow, such amaze, such automatic scale. Iconic, isn't it?
  %h3 Fade In Up
  .col-xs-9
    %figure.evoc-img
      %img{:class => "zoom",:src => "https://c1.staticflickr.com/8/7855/46031064054_23fa7ef916_k.jpg", :alt => "Nice Flickr image"}
      %figcaption
        .overlay.icons.fade-in-up
          %a{:class => "icon", :href => "https://facebook.com"}
            %i.fa.fa-facebook-square
            Facebook
          %a{:class => "icon", :href => "https://linkedin.com"}
            %i.fa.fa-linkedin-square
            LinkedIn
          %a{:class => "icon", :href => "https://github.com"}
            %i.fa.fa-github-square
            Github
        .fig-text
          %h3 Icons
          %span.title-add FADE-IN-UP
          %p Suddenly, out of the blue, a mountain appeared out of nowhere. Epic, isn't it?
  %h2 More icon styles
  .col-xs-5
    %figure.evoc-img
      %img{:class => "zoom",:src => "https://c1.staticflickr.com/8/7922/32871480588_8ef48f4ef1_b.jpg", :alt => "Nice Flickr image"}
      %figcaption
        .overlay.icons.fade-in-up.fill-in
          %a{:class => "icon", :href => "https://facebook.com"}
            %i.fa.fa-facebook-square
            Facebook
          %a{:class => "icon", :href => "https://linkedin.com"}
            %i.fa.fa-linkedin-square
            LinkedIn
          %a{:class => "icon", :href => "https://github.com"}
            %i.fa.fa-github-square
            Github
        .fig-text
          %h3 Icons
          %span.title-add fill-in
          %p I can see you clearly from up here.
  .col-xs-offset-1
  .col-xs-5
    %figure.evoc-img
      %img{:class => "zoom",:src => "https://c1.staticflickr.com/5/4857/39784564023_15bbae6a58_b.jpg", :alt => "Nice Flickr image"}
      %figcaption
        %h3 Contact   us   at
        .overlay.icons.fade-in-up.fill-in.half
          %a{:class => "icon", :href => "https://facebook.com"}
            %i.fa.fa-facebook-square
            Facebook
          %a{:class => "icon", :href => "https://linkedin.com"}
            %i.fa.fa-linkedin-square
            LinkedIn
          %a{:class => "icon", :href => "https://github.com"}
            %i.fa.fa-github-square
            Github
        .fig-text
          %h3 Icons
          %span.title-add fill-in half
          %p The quick white pinguins ate their fill only half because they still had a stomachache from the feast.

  
  //https://c1.staticflickr.com/8/7922/32871480588_8ef48f4ef1_b.jpg
  //https://c1.staticflickr.com/5/4857/39784564023_15bbae6a58_b.jpg
  
              
            
!

CSS

              
                /*
 * Want CSS styles? 
   - https://jsonformatter.org/scss-to-css
*/

$lynx-white: #f5f6fa;
$pensive-white: #dcdde1;
$harley-orange: #c23616;
$electro-black: #2f3640;

@mixin transition($property: all, $duration: 0.3s, $timing: linear, $delay: unquote("")){
  -moz-transition: unquote($property) $duration $timing $delay;
  -o-transition: unquote($property) $duration $timing $delay;
  -webkit-transition: unquote($property) $duration $timing $delay;
  transition: unquote($property) $duration $timing $delay;
}
@mixin transform($transforms) {
  -moz-transform: $transforms;
  -o-transform: $transforms;
  -ms-transform: $transforms;
  -webkit-transform: $transforms;
  transform: $transforms;
}
@mixin background-opacity($color, $opacity: 0.3) {
    background-color: $color; /* The Fallback */
    background-color: rgba($color, $opacity);
}
@mixin keyframe ($animation_name) {
    @-webkit-keyframes #{$animation-name} {
        @content;
    }

  @-moz-keyframes #{$animation_name} {
        @content;
    }

  @-o-keyframes #{$animation_name} {
        @content;
    }

  @keyframes #{$animation_name} {
        @content;
    }
}
@mixin animation ($delay, $duration, $animation) {
    -webkit-animation-delay: $delay;
    -webkit-animation-duration: $duration;
    -webkit-animation-name: $animation;
    -webkit-animation-fill-mode: forwards; /* this prevents the animation from restarting! */

    -moz-animation-delay: $delay;
    -moz-animation-duration: $duration;
    -moz-animation-name: $animation;
    -moz-animation-fill-mode: forwards; /* this prevents the animation from restarting! */

    -o-animation-delay: $delay;
    -o-animation-duration: $duration;
    -o-animation-name: $animation;
    -o-animation-fill-mode: forwards; /* this prevents the animation from restarting! */

    animation-delay: $delay;
    animation-duration: $duration;
    animation-name: $animation;
    animation-fill-mode: forwards; /* this prevents the animation from restarting! */
}


/* DEMO STYLES */
* {
  margin: 0;
  padding: 0;
  border: 0;
}

body {
  color: $lynx-white;
  background-color: $electro-black;
  font-family: 'Montserrat', sans-serif;
}

.gallery-wrap {
  width: 1600px;
  max-width: 100%;
  margin: 0 auto;
  padding-bottom: 3em;
  >h1, h2, h3 {
    font-weight: 200;
    text-transform: uppercase;
    display: block;
    width: 100%;
    padding: 3em;
    letter-spacing: 5px;
  }
  
  >h2 {
    padding: 1.5em;
    &:after {
      width: 80px;
      height: 2px;
      background: $lynx-white;
      display: block;
      content: '';
      margin: 8px auto 20px auto;
    }
    &.not-spaced {
      letter-spacing: 0;
    }
  }
  
  >h3 {
    text-transform: none;
    font-size: 1.2em;
    font-weight: 400;
    padding: 0.5em;
    letter-spacing: 0;
  }
  
  figure.evoc-img {
    
    &:hover{
      pre{
        opacity: 0;
      }
    }
    
    pre {
      margin: 3px auto;
      @include transition();
      >code{
        padding: 3px;
        @include background-opacity(#000, 0.6);
      }
    }
  }
}

/* Gallery default styles 
Using flexbox css
*/

[class*="col-"] {
  padding: 0;
  overflow: hidden;
  // background-color: $lynx-white;
  
  &.padded {
    margin-top: 3em;
  }
  
  >figure.evoc-img {
    font-size: 15px;
    position: relative;
    width: 100%;
    height: 100%;
    left: 0;
    top: 0;
    
    &:hover {
      >figcaption {
        background-color: transparent;
        
        > h3 {
          z-index: 6;
          display: block;
          @include animation(0.5s, 0.3s, fadeIn);
        }
        
        >.overlay.icons{
          z-index: 5;
          @include background-opacity($electro-black, 0.7);
 
          >a.icon {
            display: block;
            @include animation(0.5s, 0.5s, fadeIn);
          }
          &.fade-in-up > a.icon{
            @for $i from 1 through 10 {
              &:nth-child(#{$i}) {
                @include animation($i*0.3s, 0.5s, fadeInUp);
              }
            }
          }
          
          &.fill-in {
            background-position: 0;
            
            >h3 {
              color: $electro-black;
              
              &:after {
                background: $electro-black;
              }
            }
            
            &.fade-in-up > a.icon{
              color: $electro-black;
              
              @for $i from 1 through 11 {
                &:nth-child(#{$i}) {
                  @include animation(0.5 + $i*0.3s, 0.5s, fadeInUp);
                }
              }
            }
          }
          
          &+.fig-text {
            opacity: 0;
          }
        }
        
        >.fig-text {
          
          >p {
            opacity: 0;
          }
        }
      }
      >img {
        left: 0;
        top: 0;
        &.zoom {
          @include transform(scale(1.1));
          &.more {
            @include transform(scale(1.2));
          }
        }
        &.left-swipe { left: 0; }
        &.right-swipe { left: -10%; }
        &.top-swipe { top: 0; }
        &.bottom-swipe { top: -10%; }
        
        
        &.text-left-swipe{
          + figcaption > .fig-text {
            padding-left: 20%;
            padding-right: 0;
          }
        }
        &.text-right-swipe{
          + figcaption > .fig-text {
            padding-left: 0;
            padding-right: 20%;
          }
        }
        &.text-top-swipe{
          + figcaption > .fig-text {
            padding-top: 10%;
          }
        }
        &.text-bottom-swipe{
          + figcaption > .fig-text {
            margin-top: -10%;
          }
        }
      }
    }
   
    &.align-bottom {
      >figcaption {
        align-items: flex-end;
        
        >.fig-text {
          padding-bottom: 1em;
        }
      }
    }
    
    &.align-top {
      >figcaption {
        align-items: flex-start;
        
        >.fig-text {
          padding-top: 1em;
        }
      }
    }
    
    >img {
      display: block;
      position: relative;
      left: 0;
      top: 0;
      height: 100%;
      width: 100%;
      @include transition();
      
      &.left-swipe, &.right-swipe, &.top-swipe, &.bottom-swipe {
        left: -5%;
        top: -5%;
        @include transform(scale(1.2));
      }
    }
    
    >figcaption {
      position: absolute;
      display: flex;
      align-items: center;
      left: 0;
      top: 0;
      padding: 0 10%;
      height: 100%;
      width: 80%;
      text-align: left;
      @include background-opacity($electro-black, 0.5);
      @include transition();
      
      
      h3, span.title-add {
        display: inline-block;
        text-transform: uppercase;
        font-weight: 300;
        margin: 0 0 0 0;
        letter-spacing: -2px;
        top: 0;
        padding: 0;
        font-size: 1.2em;
        width: auto;
        color: $electro-black;
      }
        
      h3 {
        &:after {
          width: 40px;
          height: 2px;
          background: $electro-black;
          display: block;
          content: '';
          margin-bottom: 20px;
          margin-top: 8px;
        }
      }
      
      >h3 {
        position: absolute;
        top: 10%;
        display: none;
        opacity: 0;
        @include transform(translateY(100%));
      }
      
      
      >.fig-text {
        position: relative;
        padding: 0 10%;
        font-weight: 300;
        @include transition();
     
        >h3, >span.title-add {
          color: $lynx-white;
        }
        
        > h3 {
          &:after {
            background: $lynx-white;
          }
        }
        
        >span.title-add {
          font-weight: 500;
        }
        
        >p {
          max-width: 100%;
          @include transition();
        }
      }
      
      
      >.overlay {
        position: absolute;
        left: 0;
        top: 0;
        width: 80%;
        height: 100%;
        padding: 0 10%;
        @include transition("all", 0.3s, linear, 0.3s);
        
        
        
        &a {
          cursor: pointer;
        }
        
        &.icons {
          display: flex;
          justify-content: space-around;
          align-items: center;
          
          &.fill-in {
            background: linear-gradient(25deg, $lynx-white 50%, transparent 50%);
            background-size: 500%;
            background-position: 100%;
            
            &.half {
              background-size: 300%;
            }
            
            >a.icon {
              color: $electro-black;
              >i {
                color: inherit;
              }
            }
            
          }
          
          >a.icon {
            text-align: center;
            display: none;
            opacity: 0;
            font-size: 0.85em;
            color: $lynx-white;
            text-decoration: none;
            @include transition("color");
            
            &:hover {
              color: $pensive-white;
            }
            
            >i {
              display: block;
              color: $lynx-white;
              font-size: 3em; 
              margin-bottom: 0.5em;
              @include transition("color", 0.2s);
              
              &:hover {
                color: $harley-orange;
              }
            }            
          }
        }
      }
    }
  }
}

/* Animations defined*/
@include keyframe(fadeIn) {
  0% {opacity: 0;}
  100% {opacity: 1;}
}

@include keyframe (fadeInUp) {
  0% {opacity: 0; margin-top: 2em;}
  100% {opacity: 1; margin-top: 0;}
}

@include keyframe (fadeOut){
  0% {opacity: 1}
  99.99%{display:block}
  100%{display: none}
}




              
            
!

JS

              
                // A simple css image gallery hover framework
// Feel free to use and if you'd like, please share what you made!

// Works in IE 10+, Edge, Firefox, possibly Safari(untested) and Chrome

// Inspired by https://tympanus.net/Development/HoverEffectIdeas/
// The goal was to take some of these effects and make them more simple yet more versatile

// By Evochrome with <3
              
            
!
999px

Console