Created
August 31, 2017 08:39
-
-
Save CodeMyUI/4afa8ddc5d693c3a2c7919eae23f09e2 to your computer and use it in GitHub Desktop.
Css Image Hover Effects
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<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> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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