opacity Hover Effect

Opacity

What you need to know:

  • Opacity can be reached on 2 ways, first is filter and second is opacity - "opacity: .5;" or "opacity(100%)".
  • How to speed up or slow down hover? - In transition you have time (.4s), increase or decrease that number if you want to change it. If your time is less then 1s then you dont need to use 0, if its bigger, then just write "1.5s" or anything you need.
  • Can i change Image Size ? - Of course, that styles are basics styles, everything in 'You can change it' can be replaced.
  • Is it work on all browsers ? - It should, but if you found any problems, just please report them to me.
  • I need webkits ? - If you are using Sass with auto prefixer then no, If you dont use Sass then i suggest to have them, because of older browsers.

HTML

<div class='img-hover7'>
<img src='IMAGE-LINK-HERE'>
</div>

CSS


.img-hover7 {
/*You can change it*/
max-width: 500px;
cursor: pointer;
/*You Should leave that*/
overflow: hidden;
}
.img-hover7 img {
-webkit-transition: .4s ease-in-out;
-o-transition: .4s ease-in-out;
transition: .4s ease-in-out;
width: 100%;
/*First option:*/
filter: opacity(50%);
/*Second option:*/
opacity: .5;
}
.img-hover7 img::hover {
/*First option:*/
filter: opacity(100%);
/*Second option:*/
opacity: 1;
}

This Post Has One Comment

Leave a Reply