Quantcast
Viewing all articles
Browse latest Browse all 215

Display Link on Image hover using CSS and HTML

Image may be NSFW.
Clik here to view.
beautiful-model-wallpaper-css-mask-hover-effect
Image hover effect using CSS
Image hover effects have become an important aspect in web designing as image plays an important role in attracting users intention and hover effects tweak it to make it look appealing. This article describes yet another effect where hovering will display a link or a second image over the initial along with a mask. This effect will be highly useful in case we need visitors to follow a link after being attracted by the image used. To view the demo of this above effect please visit our Image hover effects collection Page.

HOVER EFFECT:

Image may be NSFW.
Clik here to view.
display-image-over-image-hover-effect-css-html
Illsustration of hover effect

CSS CODE:

  1. .box {
  2.    width: 300px;
  3.    height: 200px;
  4.    margin: 10px;
  5.    float: left;
  6.    border: 5px solid #fff;
  7.    overflow: hidden;
  8.    position: relative;
  9.    text-align: center;
  10.    box-shadow: 0px 0px 5px #aaa;
  11.    display: block;
  12.    position: relative;
  13.         }
  14. a.link {
  15.    background:url( Link image URL)
  16.    center no-repeat;
  17.    background-size:50px 50px;
  18.    display: inline-block;
  19.    text-decoration: none;
  20.    padding:0;
  21.    text-indent:-999px;
  22.    width:50px;
  23.    height:50px;
  24.    position:relative;
  25.    top:-15px;
  26.    opacity: 0;
  27.    transition: opacity 0.1s 0s ease-in-out;
  28.           }
  29. .mask {
  30.    width: 300px;
  31.    height: 200px;
  32.    position: absolute;
  33.    overflow: hidden;
  34.    top: 0;
  35.    left: 0;
  36.    opacity: 0;
  37.    overflow:visible;
  38.    border:5px solid rgba(0,0,0,0.9);
  39.    box-sizing:border-box;
  40.    transition: all 0.4s ease-in-out;
  41.            }
  42. .mask:hover {
  43.    opacity: 1;
  44.    border:100px solid rgba(0,0,0,0.7);
  45.                     }
  46. .mask:hover a.link {
  47.    opacity:1;
  48.    transition-delay: 0.3s;
  49.                              }
In the above code ".box" class was used to define the box surrounding the image and properties for it whereas ".link"describes the properties of the link about be displayed over it. In the above code code  the link is substituted by means of a image you can either use image of plain link here. If the size of the image is increased you need to alter the position of the link image by properties such as "top" "left" "right".

The class ".mask" defines the properties of mask that needs to be displayed when the image is hovered. Changing the border size will vary the hover effect you obtain as a result and you personally experiment with this to choose your preferred one. You also need to change the border size in case you wish to alter the size of the image used in the effect.

HTML CODE:

  1. <div class="box">
  2.   <img width="300" height="200" src="Your image URL" />
  3.      <div class="mask">  
  4.     <a href="#" class="link" title="Full Image">Large Resolution Image</a> 
  5.      </div>
  6. </div>  
I hope you like this effect and make sure you experiment with the above codes to get more patterns from this effect. Also check out our  Image hover effects collection page for more cool hover effects using simple CSS. Note that some of the effects may not work as expected this was due the template i have used and there is nothing wrong with the code or effect.

Like this article? Share this with others through social sites and don't forget to follow us. Post your comments and queries regarding this article below. Thank you for visiting and Happy coding.
 
Image may be NSFW.
Clik here to view.

Viewing all articles
Browse latest Browse all 215

Trending Articles