Goal:
Mouse hovering over the picture and its area, the title and content will raise up.
The contents background and height should go to the bottom of the area.
Problem:
The title and contents background don't go all the way down to the button.
I don't know how to do.
Please take a look at the picture for visual communication.
JSBin:
https://jsbin.com/xenavotemu/edit?html,output
Thank you!
.cards {
margin: 0 auto;
display: grid;
grid-gap: 5px;
}
.card {
width: 100%;
min-height: 100px;
background-color: #e6e6e6;
text-align: center;
border: 1px solid white;
transition: border 1s;
position: relative;
}
.card:hover {
border: 1px solid black;
}
.card .wrapper {
bottom: 0;
position: absolute;
transition: all .3s ease;
width: 100%;
}
.card:hover .wrapper {
bottom: 30px;
transform: translateY(-50%)
}
.cardTitle {
width: 100%;
margin-top: -4px;
color: white;
background-color: grey;
font-size: xx-large;
}
.cardText {
background-color: #fff;
height: 0;
opacity: 0;
visibility: hidden;
}
.card:hover .cardText {
height: 100%;
;
opacity: 1;
visibility: visible;
}
.responsive {
width: 300px;
}
/* 2 column */
@media (min-width: 700px) and (max-width: 899px) {
div.cards {
grid-template-columns: repeat(2, 1fr);
}
}
/* 3 columns */
@media (min-width: 900px) {
div.cards {
grid-template-columns: repeat(3, 1fr);
}
}
<div class="cards">
<div class="card">
<img src="https://dogtowndogtraining.com/wp-content/uploads/2012/06/300x300-061-e1340955308953.jpg" class="responsive" alt="" />
<div class="wrapper">
<div class="cardTitle">ONE</div>
<div class="cardText">aaa<br /> aaaa</div>
</div>
</div>
<div class="card">
<img src="https://dogtowndogtraining.com/wp-content/uploads/2012/06/300x300-061-e1340955308953.jpg" class="responsive" alt="" />
<div class="wrapper">
<div class="cardTitle">ONE</div>
<div class="cardText">aaa<br /> aaa<br /> aaa</div>
</div>
</div>
<div class="card">
<img src="https://dogtowndogtraining.com/wp-content/uploads/2012/06/300x300-061-e1340955308953.jpg" class="responsive" alt="" />
<div class="wrapper">
<div class="cardTitle">ONE</div>
<div class="cardText">aaa<br /> aaa<br /> aaa<br /> aaa</div>
</div>
</div>
</div>