Image overlay effect on hover using css | Sanwebcorner

Image overlay effect on hover using css

The image overlay effect  is another most commonly used hover effect for images. this will done by simple css and html code. Creating overlay effect is very simple to do using css. This is one of the better effect to show the image different manner in webpages.


Simple Overlay Effect:

In this example i show you how to create simple overlay effect with caption animation , The caption animation will comes from different  sides like left, right, top, bottom, top left, top right, bottom left and bottom right. You can able to see this caption animation along with the image overlay effect in the demo page. Please click the demo link below and check this example. The overlay effect i used in black color you may change the background color according to your wish. Check out the below simple html and css code for this effect. I hope this post is very useful.

Code for Image overlay effect on hover 

<!DOCTYPE html>
<html lang="en" >
<head>
<meta charset="UTF-8">
<title>Simple Image Overlay Effects on Hover</title>
</head>

<body>
<h1 class="main-title">Simple image overlay hover effects</h1>

<div class="container">
<h3 class="title">Text fadeIn bottom</h3>
<div class="content">
<a href="#" target="_blank">
<div class="content-overlay"></div>
<img class="content-image" src="image-overlay-effect.jpg">
<div class="content-details fadeIn-bottom">
<h3 class="content-title">This is a title</h3>
<p class="content-text">This is a short description</p>
</div>
</a>
</div>
</div>

<div class="container">
<h3 class="title">Text fadeIn top</h3>
<div class="content">
<a href="#" target="_blank">
<div class="content-overlay"></div>
<img class="content-image" src="image-overlay-effect.jpg">
<div class="content-details fadeIn-top">
<h3>This is a title</h3>
<p>This is a short description</p>
</div>
</a>
</div>
</div>

<div class="container">
<h3 class="title">Text fadeIn left</h3>
<div class="content">
<a href="#" target="_blank">
<div class="content-overlay"></div>
<img class="content-image" src="image-overlay-effect.jpg">
<div class="content-details fadeIn-left">
<h3>This is a title</h3>
<p>This is a short description</p>
</div>
</a>
</div>
</div>

<div class="container">
<h3 class="title">Text fadeIn right</h3>
<div class="content">
<a href="#" target="_blank">
<div class="content-overlay"></div>
<img class="content-image" src="image-overlay-effect.jpg">
<div class="content-details fadeIn-right">
<h3>This is a title</h3>
<p>This is a short description</p>
</div>
</a>
</div>
</div>

<div class="container">
<h3 class="title">Text fadeIn top left</h3>
<div class="content">
<a href="#" target="_blank">
<div class="content-overlay"></div>
<img class="content-image" src="image-overlay-effect.jpg">
<div class="content-details fadeIn-top fadeIn-left">
<h3>This is a title</h3>
<p>This is a short description</p>
</div>
</a>
</div>
</div>

<div class="container">
<h3 class="title">Text fadeIn top right</h3>
<div class="content">
<a href="#" target="_blank">
<div class="content-overlay"></div>
<img class="content-image" src="image-overlay-effect.jpg">
<div class="content-details fadeIn-top fadeIn-right">
<h3>This is a title</h3>
<p>This is a short description</p>
</div>
</a>
</div>
</div>

<div class="container">
<h3 class="title">Text fadeIn bottom left</h3>
<div class="content">
<a href="#" target="_blank">
<div class="content-overlay"></div>
<img class="content-image" src="image-overlay-effect.jpg">
<div class="content-details fadeIn-bottom fadeIn-left">
<h3>This is a title</h3>
<p>This is a short description</p>
</div>
</a>
</div>
</div>

<div class="container">
<h3 class="title">Text fadeIn bottom right</h3>
<div class="content">
<a href="#" target="_blank">
<div class="content-overlay"></div>
<img class="content-image" src="image-overlay-effect.jpg">
<div class="content-details fadeIn-bottom fadeIn-right">
<h3>This is a title</h3>
<p>This is a short description</p>
</div>
</a>
</div>
</div>
</body>
</html>

Css code for overlay Effect

*, *:before, *:after{
  margin: 0;
  padding: 0;
  -webkit-box-sizing: border-box;
  -moz-box-sizing:border-box;
  box-sizing: border-box;
}

body{
  background: #000;
  font-size: 16px;
  font-family: 'Raleway', sans-serif;
}



.main-title{
  color:#fff;
  text-align: center;
  text-transform: capitalize;
  padding: 0.7em 0;
}

.container{
  padding: 1em 0;
  float: left;
  width: 50%;
}
@media screen and (max-width: 640px){
  .container{
    display: block;
    width: 100%;
  }
}

@media screen and (min-width: 900px){
  .container{
    width: 33.33333%;
  }
}

.container .title{
  color: #fff;
  text-align: center;
  margin-bottom: 10px;
}

.content {
  position: relative;
  width: 90%;
  max-width: 400px;
  margin: auto;
  overflow: hidden;
}

.content .content-overlay {
  background: rgba(0,0,0,0.7);
  position: absolute;
  height: 99%;
  width: 100%;
  left: 0;
  top: 0;
  bottom: 0;
  right: 0;
  opacity: 0;
  -webkit-transition: all 0.4s ease-in-out 0s;
  -moz-transition: all 0.4s ease-in-out 0s;
  transition: all 0.4s ease-in-out 0s;
}

.content:hover .content-overlay{
  opacity: 1;
}

.content-image{
  width: 100%;
}

.content-details {
  position: absolute;
  text-align: center;
  padding-left: 1em;
  padding-right: 1em;
  width: 100%;
  top: 50%;
  left: 50%;
  opacity: 0;
  -webkit-transform: translate(-50%, -50%);
  -moz-transform: translate(-50%, -50%);
  transform: translate(-50%, -50%);
  -webkit-transition: all 0.3s ease-in-out 0s;
  -moz-transition: all 0.3s ease-in-out 0s;
  transition: all 0.3s ease-in-out 0s;
}

.content:hover .content-details{
  top: 50%;
  left: 50%;
  opacity: 1;
}

.content-details h3{
  color: #fff;
  font-weight: 500;
  letter-spacing: 0.15em;
  margin-bottom: 0.5em;
  text-transform: uppercase;
}

.content-details p{
  color: #fff;
  font-size: 0.8em;
}

.fadeIn-bottom{
  top: 80%;
}

.fadeIn-top{
  top: 20%;
}

.fadeIn-left{
  left: 20%;
}

.fadeIn-right{
  left: 80%;
}

Post a Comment

Labels

360 degree view product image 3d rotate 3d text 3step-form Accordion menu ajax All Browsers Animated Background Gradient animation audio controller auto complete Best accordion menu bootstrap border bounce effect on hover Breadcrumb calculate age by dob calendar Captcha change image on mouse move color chooser countdown Counter on scroll Css css animation css buttons css hover css3 customized upload Button Date picker delete data from table Different scroll speed email otp verification email verifier Embed eventlist Expanding Menu feedbck form flash news section close button full screen menu Google custom search Google Maps Google reCAPTCHA Google site search gradient hide menu Horizontal News ticker Hover Htm Html html5 html5 form validation Iframe image hover increment decrement textbox value based on select box Javascript Jquery js Layered image effect on mouse hover marquee marquee with close button mobile number validation mobile otp login Multi-level-drop-down-menu multi-level-form mysql News ticker on hover change text to image our team page password strength checker Photoshop PHP Popup image on click the link pure css Random password Redirect page Based on the select box while submit the form responsive responsive menu responsive popup box Responsive Vertical Time line design rotate image simple coming soon page simple countdown based on end date simple typing effect slider sliding tab sms otp login statistic counter on scroll switch tag shape team member Time picker toggle toggle view transparent button underline animation up down slide validation vertical fixed sidebar Webtips Youtube