Skip to content

Instantly share code, notes, and snippets.

@51enra
Created November 11, 2019 07:56
Show Gist options
  • Save 51enra/a39f61083fc9a142a3a5f1fe3c1efcec to your computer and use it in GitHub Desktop.
Save 51enra/a39f61083fc9a142a3a5f1fe3c1efcec to your computer and use it in GitHub Desktop.
Gandalf image
<div class="picture">
<img src="http://images.innoveduc.fr/integration_gandalf.png">
<div class="cover">
<div class="reward">
Reward <span class="amount">1000</span><br> golden coins
</div>
<div class="name">Gandalf</div>
</div>
</div>
.picture {
position: absolute;
font-family: Arial;
display: flex;
}
.cover {
position: absolute;
background-color: rgba(255,255,255,0.4);
width: 100%;
height: 100%;
display: flex;
flex-direction: column;
justify-content: flex-start;
align-items: center;
}
.reward {
font-size: 2em;
background-color: rgba(255,255,255,0.8);
padding: 0.5em 2em;
margin: 1em;
border-radius: 10px;
}
.amount {
color: orange;
}
.name {
font-size: 3.5em;
color: white;
padding: 2em 0em;
}
.cover:hover {
background-color: rgba(0,0,0,0);
justify-content: flex-end;
}
.cover:hover >.reward {
display: none;
}
.cover:hover .name {
font-size: 1.5em;
}
https://codepen.io/51enra/full/oNNyyXq
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment