Skip to content

Instantly share code, notes, and snippets.

@jimmyachour
Created February 3, 2019 13:32
Show Gist options
  • Save jimmyachour/1cb6e565bd7f37110750a188969506cb to your computer and use it in GitHub Desktop.
Save jimmyachour/1cb6e565bd7f37110750a188969506cb to your computer and use it in GitHub Desktop.
Gandalf Hover v2
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>Gandalf</title>
<link rel="stylesheet" href="style.css">
</head>
<body>
<section>
<img src="http://images.innoveduc.fr/integration_gandalf.png">
<div class="container">
<div class="container__info">
<p>reward <span>1000</span><br/>golden coins</p>
</div>
<h2>Gandalf</h2>
</div>
</section>
</body>
</html>
body{
margin: 0;
padding:0;
}
section{
position: relative;
display: inline-block;
}
img{
opacity: 0.5;
transition: 1s;
}
.container{
position: absolute;
top: 0;
width: 90%;
height: 100%;
margin-left: 5%;
}
.container__info{
background-color: white;
border-radius: 10px;
font-size: 30px;
line-height: 40px;
opacity: 0.8;
}
.container__info p{
padding: 10px;
font-weight: 100;
}
span{
color: #ff8800;
}
.container__info p, h2{
text-align: center;
}
h2{
margin-top: 40%;
font-size: 4em;
color: white;
}
section:hover img{
opacity: 1;
}
section:hover .container__info{
display: none;
}
section:hover h2{
margin-top: 100%;
font-size:2em;
transition: 1s;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment