Skip to content

Instantly share code, notes, and snippets.

@MkLHX
Last active October 15, 2018 16:26
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save MkLHX/a5c3b485adb003641e1338f7b982eace to your computer and use it in GitHub Desktop.
Save MkLHX/a5c3b485adb003641e1338f7b982eace to your computer and use it in GitHub Desktop.
.wrapper{
position: relative;
text-align: center !important;
}
.card{
width: 500px;
margin: 0 auto;
}
.head{
position: absolute;
top: 10px;
left: 38.25%;
width: 420px;
padding: 15px;
color: black;
font-size: 50px;
background-color: rgba(255,255,255,.7);
border-radius: 20px;
z-index: 1000;
}
.head span{
color: orangered;
}
img{
border-radius: 8px;
filter: opacity(35%);
z-index: 999;
width: 500px;
}
.hero{
color: whitesmoke;;
position: absolute;
top: 45%;
left: 43.25%;
right: auto;
padding: 15px;
font-size: 60px;
/*display: none;*/
z-index: 1001;
}
.card:hover img{
filter: opacity(100%);
}
.card:hover > .head{
display: none;
}
.card:hover > .hero{
top: 85%;
font-size: 35px;
left: 45.8%;
}
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport"
content="width=device-width, user-scalable=no, initial-scale=1.0, maximum-scale=1.0, minimum-scale=1.0">
<meta http-equiv="X-UA-Compatible" content="ie=edge">
<link rel="stylesheet" href="scratch.css">
<title>Donne du style avec CSS</title>
</head>
<body>
<div class="wrapper">
<div class="card">
<div class="head">
reward <span>1000</span><br> golden coins
</div>
<p>
<img src="http://images.innoveduc.fr/integration_gandalf.png" alt="Gandalf Picture">
<div class="hero">Gandalf</div>
</p>
</div>
</div>
</body>
</html>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment