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 is required to process package imports. If you need a different preprocessor remove all packages first.

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

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

              
                <div class='container-inner'>
   <ul class="blue">
      <li>
         <div class='info'>
            <p>Pellentesque habitant morbi tristique senectus et netus et 
               malesuada fames ac turpis egestas. Vestibulum tortor quam,
               feugiat vitae, ultricies eget, tempor sit amet, ante. 
               Donec eu libero sit amet quam egestas semper.</p>   
         </div>
      </li>
      <li> 
         <a class="box" href="javascript:void(0);">
            <span class="icon-close">
               <svg width="57" height="57" viewBox="0 0 57 57" fill="none" xmlns="http://www.w3.org/2000/svg">
                  <rect width="40" height="40" fill="black" fill-opacity="0" transform="translate(28.0537) rotate(44.535)"/>
                  <rect width="40" height="40" fill="black" fill-opacity="0" transform="translate(28.0537) rotate(44.535)"/>
                  <rect width="40" height="40" fill="black" fill-opacity="0" transform="translate(28.0537) rotate(44.535)"/>
                  <path d="M53.7612 30.9051L53.7153 25.2484L31.0887 25.432L30.905 2.80538L25.2483 2.85129L25.432 25.478L2.80532 25.6616L2.85123 31.3183L25.4779 31.1346L25.6616 53.7613L31.3182 53.7154L31.1346 31.0887L53.7612 30.9051Z" fill="#3116F8"/>
               </svg>
            </span>
            <span class="txt">contact <br> us &bull;</span>
            <div class='info standard'>

            </div>
           </a>
      </li>
   </ul>
</div>
              
            
!

CSS

              
                
@mixin flex() {
    display: -webkit-box;
    display: -moz-box;
    display: -ms-flexbox;
    display: -webkit-flex;
    display: flex;
}
@mixin flex-wrap(){
    -webkit-flex-wrap:wrap;
    -ms-flex-wrap:wrap;
        flex-wrap:wrap;
}
.icon-close {
   display: block;
   text-align: center;
   svg {
      margin-top: calc(70% / 2);
      margin-bottom: 20px;
   }
}
.txt {
   text-decoration: none;
   text-align: center;
   display: block;
   color: blue;
   font-size: 22px;
   transition:0.5s all ease;
   position: relative;
   z-index: 50;
   line-height: 1;
}

.container-inner {
    float:left;
    width:100%;
    ul {
        margin: 0 auto;
        padding: 0;
        // width: 575px;
        @include flex;
        @include flex-wrap;
        &:after {
          content: "";
          display: table;
          clear: both;
        }
        li {
           &:hover {
              svg {
                 position: relative;
                 z-index: 5;
                 path {
                    fill: white;
                 }
              }
              .txt {
                 color: white;
              }
           }
            background-color: rgba(256, 18, 156, 0.9);
            -webkit-perspective: 540px;
                    perspective: 540px;


            position: relative;
            
            width: calc(25% - 10px);
            height: 290px;
            margin: 5px;
            padding: 0;
            list-style: none;
                .info {
                -webkit-transform: rotate3d(1, 0, 0, 90deg);
                transform: rotate3d(1, 0, 0, 90deg);
                width: 100%;
                height: 100%;
                padding: 0px 10px;
                position: absolute;
                top: 0;
                left: 0;
                border-radius: 4px;
                pointer-events: none;
                background-color: rgba(26, 88, 156, 0.9);
                p {
                    color:#fff;
                }
            }
        }
    }
 }

 

 

 


  
 
 .in-top .info {
   -webkit-transform-origin: 50% 0%;
       -ms-transform-origin: 50% 0%;
           transform-origin: 50% 0%;
   -webkit-animation: in-top 300ms ease 0ms 1 forwards;
           animation: in-top 300ms ease 0ms 1 forwards;
 }
 
 .in-right .info {
   -webkit-transform-origin: 100% 0%;
       -ms-transform-origin: 100% 0%;
           transform-origin: 100% 0%;
   -webkit-animation: in-right 300ms ease 0ms 1 forwards;
           animation: in-right 300ms ease 0ms 1 forwards;
 }
 
 .in-bottom .info {
   -webkit-transform-origin: 50% 100%;
       -ms-transform-origin: 50% 100%;
           transform-origin: 50% 100%;
   -webkit-animation: in-bottom 300ms ease 0ms 1 forwards;
           animation: in-bottom 300ms ease 0ms 1 forwards;
 }
 
 .in-left .info {
   -webkit-transform-origin: 0% 0%;
       -ms-transform-origin: 0% 0%;
           transform-origin: 0% 0%;
   -webkit-animation: in-left 300ms ease 0ms 1 forwards;
           animation: in-left 300ms ease 0ms 1 forwards;
 }
 
 .out-top .info {
   -webkit-transform-origin: 50% 0%;
       -ms-transform-origin: 50% 0%;
           transform-origin: 50% 0%;
   -webkit-animation: out-top 300ms ease 0ms 1 forwards;
           animation: out-top 300ms ease 0ms 1 forwards;
 }
 
 .out-right .info {
   -webkit-transform-origin: 100% 50%;
       -ms-transform-origin: 100% 50%;
           transform-origin: 100% 50%;
   -webkit-animation: out-right 300ms ease 0ms 1 forwards;
           animation: out-right 300ms ease 0ms 1 forwards;
 }
 
 .out-bottom .info {
   -webkit-transform-origin: 50% 100%;
       -ms-transform-origin: 50% 100%;
           transform-origin: 50% 100%;
   -webkit-animation: out-bottom 300ms ease 0ms 1 forwards;
           animation: out-bottom 300ms ease 0ms 1 forwards;
 }
 
 .out-left .info {
   -webkit-transform-origin: 0% 0%;
       -ms-transform-origin: 0% 0%;
           transform-origin: 0% 0%;
   -webkit-animation: out-left 300ms ease 0ms 1 forwards;
           animation: out-left 300ms ease 0ms 1 forwards;
 }
 
 @-webkit-keyframes in-top {
   from {
     -webkit-transform: rotate3d(-1, 0, 0, 90deg);
             transform: rotate3d(-1, 0, 0, 90deg);
   }
   to {
     -webkit-transform: rotate3d(0, 0, 0, 0deg);
             transform: rotate3d(0, 0, 0, 0deg);
   }
 }
 
 @keyframes in-top {
   from {
     -webkit-transform: rotate3d(-1, 0, 0, 90deg);
             transform: rotate3d(-1, 0, 0, 90deg);
   }
   to {
     -webkit-transform: rotate3d(0, 0, 0, 0deg);
             transform: rotate3d(0, 0, 0, 0deg);
   }
 }
 @-webkit-keyframes in-right {
   from {
     -webkit-transform: rotate3d(0, -1, 0, 90deg);
             transform: rotate3d(0, -1, 0, 90deg);
   }
   to {
     -webkit-transform: rotate3d(0, 0, 0, 0deg);
             transform: rotate3d(0, 0, 0, 0deg);
   }
 }
 @keyframes in-right {
   from {
     -webkit-transform: rotate3d(0, -1, 0, 90deg);
             transform: rotate3d(0, -1, 0, 90deg);
   }
   to {
     -webkit-transform: rotate3d(0, 0, 0, 0deg);
             transform: rotate3d(0, 0, 0, 0deg);
   }
 }
 @-webkit-keyframes in-bottom {
   from {
     -webkit-transform: rotate3d(1, 0, 0, 90deg);
             transform: rotate3d(1, 0, 0, 90deg);
   }
   to {
     -webkit-transform: rotate3d(0, 0, 0, 0deg);
             transform: rotate3d(0, 0, 0, 0deg);
   }
 }
 @keyframes in-bottom {
   from {
     -webkit-transform: rotate3d(1, 0, 0, 90deg);
             transform: rotate3d(1, 0, 0, 90deg);
   }
   to {
     -webkit-transform: rotate3d(0, 0, 0, 0deg);
             transform: rotate3d(0, 0, 0, 0deg);
   }
 }
 @-webkit-keyframes in-left {
   from {
     -webkit-transform: rotate3d(0, 1, 0, 90deg);
             transform: rotate3d(0, 1, 0, 90deg);
   }
   to {
     -webkit-transform: rotate3d(0, 0, 0, 0deg);
             transform: rotate3d(0, 0, 0, 0deg);
   }
 }
 @keyframes in-left {
   from {
     -webkit-transform: rotate3d(0, 1, 0, 90deg);
             transform: rotate3d(0, 1, 0, 90deg);
   }
   to {
     -webkit-transform: rotate3d(0, 0, 0, 0deg);
             transform: rotate3d(0, 0, 0, 0deg);
   }
 }
 @-webkit-keyframes out-top {
   from {
     -webkit-transform: rotate3d(0, 0, 0, 0deg);
             transform: rotate3d(0, 0, 0, 0deg);
   }
   to {
     -webkit-transform: rotate3d(-1, 0, 0, 104deg);
             transform: rotate3d(-1, 0, 0, 104deg);
   }
 }
 @keyframes out-top {
   from {
     -webkit-transform: rotate3d(0, 0, 0, 0deg);
             transform: rotate3d(0, 0, 0, 0deg);
   }
   to {
     -webkit-transform: rotate3d(-1, 0, 0, 104deg);
             transform: rotate3d(-1, 0, 0, 104deg);
   }
 }
 @-webkit-keyframes out-right {
   from {
     -webkit-transform: rotate3d(0, 0, 0, 0deg);
             transform: rotate3d(0, 0, 0, 0deg);
   }
   to {
     -webkit-transform: rotate3d(0, -1, 0, 104deg);
             transform: rotate3d(0, -1, 0, 104deg);
   }
 }
 @keyframes out-right {
   from {
     -webkit-transform: rotate3d(0, 0, 0, 0deg);
             transform: rotate3d(0, 0, 0, 0deg);
   }
   to {
     -webkit-transform: rotate3d(0, -1, 0, 104deg);
             transform: rotate3d(0, -1, 0, 104deg);
   }
 }
 @-webkit-keyframes out-bottom {
   from {
     -webkit-transform: rotate3d(0, 0, 0, 0deg);
             transform: rotate3d(0, 0, 0, 0deg);
   }
   to {
     -webkit-transform: rotate3d(1, 0, 0, 104deg);
             transform: rotate3d(1, 0, 0, 104deg);
   }
 }
 @keyframes out-bottom {
   from {
     -webkit-transform: rotate3d(0, 0, 0, 0deg);
             transform: rotate3d(0, 0, 0, 0deg);
   }
   to {
     -webkit-transform: rotate3d(1, 0, 0, 104deg);
             transform: rotate3d(1, 0, 0, 104deg);
   }
 }
 @-webkit-keyframes out-left {
   from {
     -webkit-transform: rotate3d(0, 0, 0, 0deg);
             transform: rotate3d(0, 0, 0, 0deg);
   }
   to {
     -webkit-transform: rotate3d(0, 1, 0, 104deg);
             transform: rotate3d(0, 1, 0, 104deg);
   }
 }
 @keyframes out-left {
   from {
     -webkit-transform: rotate3d(0, 0, 0, 0deg);
             transform: rotate3d(0, 0, 0, 0deg);
   }
   to {
     -webkit-transform: rotate3d(0, 1, 0, 104deg);
             transform: rotate3d(0, 1, 0, 104deg);
   }
 }

              
            
!

JS

              
                var nodes  = document.querySelectorAll('li'),
    _nodes = [].slice.call(nodes, 0);

var getDirection = function (ev, obj) {
    var w = obj.offsetWidth,
        h = obj.offsetHeight,
        x = (ev.pageX - obj.offsetLeft - (w / 2) * (w > h ? (h / w) : 1)),
        y = (ev.pageY - obj.offsetTop - (h / 2) * (h > w ? (w / h) : 1)),
        d = Math.round( Math.atan2(y, x) / 1.57079633 + 5 ) % 4;
  
    return d;
};

var addClass = function ( ev, obj, state ) {
    var direction = getDirection( ev, obj ),
        class_suffix = "";
    
    obj.className = "";
    
    switch ( direction ) {
        case 0 : class_suffix = '-top';    break;
        case 1 : class_suffix = '-right';  break;
        case 2 : class_suffix = '-bottom'; break;
        case 3 : class_suffix = '-left';   break;
    }
    
    obj.classList.add( state + class_suffix );
};

// bind events
_nodes.forEach(function (el) {
    el.addEventListener('mouseover', function (ev) {
        addClass( ev, this, 'in' );
    }, false);

    el.addEventListener('mouseout', function (ev) {
        addClass( ev, this, 'out' );
    }, false);
});
              
            
!
999px

Console