I want to slide the text { transform: scale(1.3) translate(0px, 40px); }
while I am hovering the image, (with class="img"
), but I don't know why this is not working.
.img {
position: relative;
margin: 50px;
transition: transform 0.5s;
border-radius: 85px;
}
.img:hover {
position: relative;
cursor: pointer;
transform: scale(1.3) translate(0px, -80px);
z-index: 100;
box-shadow: 0 5px 25px rgba(0, 0, 0, 0.525);
border-radius: 85px;
}
.caption {
overflow: hidden;
margin-top: -150px;
transition: transform 0.5s;
}
.img:hover .caption {
transform: scale(1.3) translate(0px, 40px);
overflow: auto;
}
<div class="container">
<ul>
<li>
<a href="games/tictactoe.html"><img id="picture" class="img" src="https://picsum.photos/100/100" alt="TicTacToe"></a>
<div class="caption">
<h3 class="gametitle">Tic Tac Toe</h3>
<h2>Game for two players</h2>
</div>
</li>
<li>
<a href="games/battleship.html"><img class="img" src="https://picsum.photos/100/100" alt="battleShip"></a>
<div class="caption">
<h3 class="gametitle">Battle Ship</h3>
<h2>Game for two players</h2>
</div>
</li>
<li>
<a href="games/pythagoreantable.html"><img class="img" src="https://picsum.photos/100/100" alt="pythagoreantable"></a>
<div class="caption">
<h3 class="gametitle">Pythagorean Table</h3>
<h2>Tool</h2>
</div>
</li>
</ul>
</div>
I think the string ".img:hover .caption" is wrong, I tried in other ways but no one worked. Thanks for the help