How To Create Image Hover Overlay Effects

How To Create Image Hover Overlay Effects

In this video, we’re gonna create an amazing Css Image of Hover Effects by just using CSS. So if you wanna learn how to create image hover overlay effects with a caption, stay in tune.

Css Image Hover Effects – Pure Css Tutorial

HTML Codes

<!DOCTYPE html>
<html lang="en">
  <head>
    <meta charset="UTF-8" />
    <meta http-equiv="X-UA-Compatible" content="IE=edge" />
    <meta name="viewport" content="width=device-width, initial-scale=1.0" />
    <title>
      Css Image Hover Effects - Pure Css Tutorial - How To Create Image Hover
      Overlay Effects | Navid Dev
    </title>
    <link rel="stylesheet" href="style.css" />
  </head>
  <body>
    <figure class="image-hover">
      <img
        src="https://s3-us-west-2.amazonaws.com/s.cdpn.io/331810/sample38.jpg"
        alt="sample38"
      />
      <div class="title">
        <div>
          <h2>Penny</h2>
          <h4>Tool</h4>
        </div>
      </div>
      <figcaption>
        <p>
          Which is worse, that everyone has his price, or that the price is
          always so low.
        </p>
      </figcaption>
      <a href="#"></a>
    </figure>
    <figure class="image-hover">
      <img
        src="https://s3-us-west-2.amazonaws.com/s.cdpn.io/331810/sample35.jpg"
        alt="sample38"
      />
      <div class="title">
        <div>
          <h2>Penny</h2>
          <h4>Tool</h4>
        </div>
      </div>
      <figcaption>
        <p>
          Which is worse, that everyone has his price, or that the price is
          always so low.
        </p>
      </figcaption>
      <a href="#"></a>
    </figure>
    <figure class="image-hover">
      <img
        src="https://s3-us-west-2.amazonaws.com/s.cdpn.io/331810/sample39.jpg"
        alt="sample38"
      />
      <div class="title">
        <div>
          <h2>Penny</h2>
          <h4>Tool</h4>
        </div>
      </div>
      <figcaption>
        <p>
          Which is worse, that everyone has his price, or that the price is
          always so low.
        </p>
      </figcaption>
      <a href="#"></a>
    </figure>
  </body>
</html>

CSS Codes

@import url(https://fonts.googleapis.com/css?family=Raleway:400,500,700);
* {
  padding: 0;
  margin: 0;
  box-sizing: border-box;
}
body {
  font-family: 'Raleway', sans-serif;
  background-color: #212121;
  display: flex;
  justify-content: center;
  align-items: center;
  flex-flow: wrap;
  height: 100vh;
}
.image-hover {
  position: relative;
  overflow: hidden;
  margin: 10px;
  min-width: 230px;
  max-width: 315px;
  width: 100%;
  color: #fff;
  text-align: center;
  font-size: 1rem;
  background-color: #000;
}
.image-hover img {
  max-width: 100%;
  vertical-align: top;
}
.image-hover .title {
  position: absolute;
  top: 58%;
  left: 25px;
  padding: 5px 10px 10px;
}
.image-hover .title::before,
.image-hover .title::after {
  height: 2px;
  width: 400px;
  position: absolute;
  content: '';
  background-color: aqua;
}
.image-hover .title::before {
  top: 0;
  left: 10px;
  transform: translateX(100%);
}
.image-hover .title::after {
  bottom: 0;
  right: 10px;
  transform: translateX(-100%);
}
.image-hover .title div::before,
.image-hover .title div::after {
  width: 2px;
  height: 300px;
  position: absolute;
  content: '';
  background-color: rgb(255, 255, 255);
}
.image-hover .title div::before {
  top: 10px;
  right: 0;
  transform: translateY(100%);
}
.image-hover .title div::after {
  bottom: 10px;
  left: 0;
  transform: translateY(-100%);
}
.image-hover h2,
.image-hover h4 {
  margin: 0;
  text-transform: uppercase;
}
.image-hover h2 {
  font-weight: 400;
}
.image-hover h4 {
  font-weight: 700;
  background-color: #fff;
  padding: 5px 10px;
  color: #000;
}
.image-hover figcaption {
  position: absolute;
  bottom: 42%;
  left: 25px;
  text-align: left;
  opacity: 0;
  padding: 5px 60px 5px 10px;
  font-size: 0.8rem;
  font-weight: 500;
  letter-spacing: 1.5px;
}
.image-hover a {
  position: absolute;
  inset: 0;
}
.image-hover:hover img {
  zoom: 1;
  filter: alpha(opacity=35);
  opacity: 0.35;
}
.image-hover:hover .title::before,
.image-hover:hover .title::after,
.image-hover:hover .title div::before,
.image-hover:hover .title div::after {
  transform: translate(0);
}
.image-hover:hover .title::before,
.image-hover:hover .title::after {
  transition-delay: 0.15s;
}
.image-hover:hover figcaption {
  opacity: 1;
  transition-delay: 0.2s;
}
.image-hover *,
.image-hover *::before,
.image-hover *::after {
  transition: all 0.55s ease;
}

Leave a Reply

Your email address will not be published. Required fields are marked *