<div class="container">
<div class="image-box">
<img src="https://image.ibb.co/cahagv/green.jpg" title="" alt="">
<div class="text-box">
<h1>Pure Css - Hover effect</h1>
<p>Hamsa Sabry</p>
</div>
</div>
</div>
body {
margin: 0;
padding: 0;
background: #003444;
}
.container {
margin: 30px auto;
width: 600px;
}
.image-box {
position: relative;
overflow: hidden;
}
.image-box img {
width: 100%;
transition: .5s
}
.text-box {
position: absolute;
top: 0;
left: -100%;
height: 100%;
width: 100%;
background: rgba(0, 52, 68, 0.5);
transition: 0.5s
}
.text-box h1 {
margin: 0;
padding: 0;
position: absolute;
top: 50%;
left: 71%;
width: 100%;
color: #FFF;
font-family: arial;
transform: translateX(-50%) translateY(-50%);
}
.text-box p {
margin: 0;
padding: 0;
position: absolute;
top: 60%;
left: 112%;
width: 100%;
color: #FFF;
font-family: arial;
transform: translateX(-50%) translateY(-50%);
}
.image-box:hover .text-box {
left: 0%;
}
.image-box:hover img {
transform: scale(1.2)
}
This Pen doesn't use any external CSS resources.
This Pen doesn't use any external JavaScript resources.