JSFiddle - React, Tailwind, and code Playground
by ppgab
HTML
<div class="wrapper">
<div title="Clique para abrir" class="card"><img src="https://images.unsplash.com/photo-1477666250292-1419fac4c25c?auto=format&fit=crop&w=667&q=80&ixid=dW5zcGxhc2guY29tOzs7Ozs%3D"/>
<div class="info">
<h1>Story Maps 1</h1>
<p>Descrição sobre o story maps 1</p>
</div>
</div>
<div title="Clique para abrir" class="card"><img src="https://images.unsplash.com/photo-1425342605259-25d80e320565?auto=format&fit=crop&w=750&q=80&ixid=dW5zcGxhc2guY29tOzs7Ozs%3D"/>
<div class="info">
<h1>Story Maps 2</h1>
<p>Descrição sobre o story maps 2</p>
</div>
</div>
<div title="Clique para abrir" class="card"><img src="https://images.unsplash.com/photo-1503249023995-51b0f3778ccf?auto=format&fit=crop&w=311&q=80&ixid=dW5zcGxhc2guY29tOzs7Ozs%3D"/>
<div class="info">
<h1>Story Maps 3</h1>
<p>Descrição sobre o story maps 3</p>
</div>
</div>
</div>
CSS
* {
box-sizing: border-box;
}
body, html {
width: 100%;
height: 100%;
display: flex;
align-items: center;
justify-content: center;
background: orange;
}
.wrapper {
display: flex;
width: 90%;
justify-content: space-around;
}
.card {
width: 250px;
height: 250px;
padding: 1.5rem;
background: white;
position: relative;
display: flex;
flex-direction: column;
justify-content: end;
align-items: center;
transition: 0.4s ease-out;
box-shadow: 0px 7px 10px rgba(0, 0, 0, 0.5);
overflow: hidden;
cursor: pointer;
}
.card:hover {
-webkit-transform: translateY(20px);
transform: translateY(20px);
}
.card:hover:before {
opacity: 1;
}
.card:hover .info {
opacity: 1;
-webkit-transform: translateY(0px);
transform: translateY(0px);
}
.card:before {
content: "";
position: absolute;
top: 0;
left: 0;
display: block;
width: 100%;
height: 100%;
background: rgba(0, 0, 0, 0.6);
z-index: 2;
transition: 0.5s;
opacity: 0.3;
}
.card img {
width: 100%;
height: 100%;
-o-object-fit: cover;
object-fit: cover;
position: absolute;
top: 0;
left: 0;
}
.card .info {
position: relative;
z-index: 3;
color: white;
-webkit-transform: translateY(calc(100% - 2.5rem));
transform: translateY(calc(100% - 2.5rem));
transition: 0.5s;
padding-bottom: 1.5rem;
margin-bottom: -1.5rem;
}
.card .info h1 {
margin: 0px;
height: 2rem;
max-height: 2rem;
padding-bottom: 0.5rem;
}
.card .info p {
letter-spacing: 1px;
font-size: 15px;
margin-top: 8px;
}
.card .info button {
padding: 0.6rem;
outline: none;
border: none;
border-radius: 3px;
background: white;
color: black;
font-weight: bold;
cursor: pointer;
transition: 0.4s ease;
}
.card .info button:hover {
background: dodgerblue;
color: white;
}