Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
Css Image Hover Effects
<html lang="en">
<head>
<meta charset="utf-8">
<title></title>
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<meta name="description" content="">
<meta name="author" content="">
<link href="style.css" rel="stylesheet"/>
</head>
<body>
<div class="card">
<div class="imgBx">
<img src="https://wallpaperscraft.ru/image/gory_reka_derevya_izgiby_hvoynye_6386_300x400.jpg">
</div>
<div class="details">
<h2>What is Lorem Ipsum?</h2>
<p>Lorem Ipsum is simply dummy text of the printing and typesetting industry. Lorem Ipsum has been the industry's standard dummy text ever since the 1500s, when an unknown printer took a galley of type and scrambled it to make a type specimen book.</p>
</div>
</div>
</body>
</html>
body {
margin: 0;
padding: 0;
font-family: sans-serif;
}
.card {
position: absolute;
top: 50%;
left: 50%;
transform: translate(-50%,-50%);
width: 300px;
height: 400px;
background: #262626;
overflow: hidden;
}
.card .imgBx,
.card .details {
width: 100%;
height: 100%;
position: absolute;
box-sizing: border-box;
transition: .5s;
}
.card .imgBx {
top: 0;
left: 0;
}
.card:hover .imgBx {
top: 0;
left: -100%;
}
.card .imgBx img {
width: 100%;
}
.card .details {
background: #262626;
top: 0;
left: 100%;
padding: 60px 30px;
}
.card:hover .details {
top: 0;
left: 0%;
}
.card .details h2 {
color: #fff;
text-align: center;
margin: 0;
padding: 0 0 10px;
border-bottom: 2px solid #fff;
}
.card .details p {
margin: 20px 0 0;
color: #fff;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.