290
0

Responsive Cards With Hover Text Effect with HTML & CSS Only

290
0

Responsive Boxes with Hovering text Effect in Pure HTML & CSS. Lets see the code

HTML File

<!DOCTYPE html>
<html lang="en" dir="ltr">
  <head>
    <meta charset="utf-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Responsive Cards With Hover Text Effect</title>
    <link rel="stylesheet" href="style.css">
  </head>
  <body>

    <!--image card layout start-->
    <div class="container">
      <!--image row start-->
      <div class="row">
        <!--image card start-->
        <div class="image">
          <img src="1.jpg" alt="">
          <div class="details">
            <h2>Your <span>Title</span></h2>
            <p>Hovering Text Details</p>
            <div class="more">
              <a href="#" class="read-more">Read <span>More</span></a>
            </div>
          </div>
        </div>
        <!--image card end-->
        <!--image card start-->
        <div class="image">
          <img src="2.jpg" alt="">
          <div class="details">
            <h2>Your <span>Title</span></h2>
            <p>Hovering Text Details</p>
            <div class="more">
              <a href="#" class="read-more">Read <span>More</span></a>
            </div>
          </div>
        </div>
        <!--image card end-->
        <!--image card start-->
        <div class="image">
          <img src="3.jpg" alt="">
          <div class="details">
            <h2>Your <span>Title</span></h2>
            <p>Hovering Text Details</p>
            <div class="more">
              <a href="#" class="read-more">Read <span>More</span></a>
            </div>
          </div>
        </div>
        <!--image card end-->
      </div>
      <!--image row end-->
      <!--image row start-->
      <div class="row">
        <!--image card start-->
        <div class="image">
          <img src="4.jpg" alt="">
          <div class="details">
            <h2>Your <span>Title</span></h2>
            <p>Hovering Text Details</p>
            <div class="more">
              <a href="#" class="read-more">Read <span>More</span></a>
            </div>
          </div>
        </div>
        <!--image card end-->
        <!--image card start-->
        <div class="image">
          <img src="5.jpg" alt="">
          <div class="details">
            <h2>Your <span>Title</span></h2>
            <p>Hovering Text Details</p>
            <div class="more">
              <a href="#" class="read-more">Read <span>More</span></a>
            </div>
          </div>
        </div>
        <!--image card end-->
        <!--image card start-->
        <div class="image">
          <img src="6.jpg" alt="">
          <div class="details">
            <h2>Your <span>Title</span></h2>
            <p>Hovering Text Details</p>
            <div class="more">
              <a href="#" class="read-more">Read <span>More</span></a>
            </div>
          </div>
        </div>
        <!--image card end-->
      </div>
      <!--image row end-->
    </div>
    <!--image card layout end-->

  </body>
</html>
      

Css File


*{
	margin: 0;
	padding: 0;
	box-sizing: border-box;
}

body{
	height: 100vh;
	background: #2F3238;
}

.container{
	margin: 30px;
}

.row{
	width: 100%;
	display: flex;
	justify-content: center;
	flex-wrap: wrap;
}

.image{
	background: #50A7FF;
	position: relative;
	flex: 1;
	max-width: 460px;
	height: 300px;
	margin: 20px;
	overflow: hidden;
}

.image img{
	opacity: 0.8;
	position: relative;
	vertical-align: top;
	transition: 0.6s;
	transition-property: opacity;
}

.image:hover img{
	opacity: 1;
}

.image .details{
	z-index: 1;
	position: absolute;
	top: 0;
	right: 0;
	color: #fff;
	width: 100%;
	height: 100%;
}

.image .details h2{
	text-align: center;
	font-size: 35px;
	text-transform: uppercase;
	font-weight: 300;
	margin-top: 70px;
	transition: 0.4s;
	transition-property: transform;
}

.image .details h2 span{
	font-weight: 900;
}

.image:hover .details h2{
	transform: translateY(-30px);
}

.image .details p{
	margin: 30px 30px 0 30px;
	font-size: 18px;
	font-weight: 600;
	text-align: center;
	opacity: 0;
	transition: 0.6s;
	transition-property: opacity, transform;
}

.image:hover .details p{
	opacity: 1;
	transform: translateY(-40px);
}

.more{
	position: absolute;
	background: rgba(255, 255, 255, 0.8);
	width: 100%;
	display: flex;
	justify-content: center;
	align-items: center;
	padding: 15px;
	bottom: -60px;
	transition: 0.6s;
	transition-property: bottom;
}

.image:hover .more{
	bottom: 0;
}

.more .read-more{
	color: #000;
	text-decoration: none;
	font-size: 20px;
	font-weight: 500;
	text-transform: uppercase;
}

.more .read-more span{
	font-weight: 900;
}



/* Responsive CSS */

@media (max-width: 1080px){
	.image{
		flex: 100%;
		max-width: 480px;
	}
}

@media (max-width: 400px){
	.image .details p{
		font-size: 16px;
	}

	.more .read-more, .more .icon-links a i{
		font-size: 18px;
	}
}
      

Leave a Reply

Your email address will not be published.