I'm looking for a CSS-only solution (NO JQuery) to display a FontAwsome icon (
<i class='fas fa-arrow-alt-circle-left fa-lg arrowbounce text-success hidearrowbounce'></i>
) only when hovering over another element. However, despite attempting to initially hide it with .hidearrowbounce
, it seems to have the opposite effect - showing on load but disappearing on hover. How can I make it hidden initially and then show up when hovering over?
My Code:
.hidearrowbounce {
display: none;
}
.tr_user_done:hover {
background: #e9ecef;
cursor: pointer;
}
.tr_user_done:hover .TextSpanDone:hover {
color: #28a745;
}
.tr_user_done:hover .TextSpanDone:hover {
visibility: hidden;
position: relative;
}
.tr_user_done:hover .TextSpanDone:hover:after + .hidearrowbounce {
visibility: visible;
position: absolute;
width: 100%;
!important;
top: 0;
left: 0;
content: attr(data-hover);
color: #28a745;
vertical-align: top;
}
.arrowbounce {
position: absolute;
width: 50px;
right: 10px;
margin: 5px;
animation: bounce 1s infinite alternate;
-webkit-animation: bounce 1s infinite alternate;
}
@keyframes bounce {
from {
transform: translateX(0px);
}
to {
transform: translateX(-15px);
}
}
@-webkit-keyframes bounce {
from {
transform: translateX(0px);
}
to {
transform: translateX(-15px);
}
}
<link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/<a href="/cdn-cgi/l/email-protection" class="__cf_email__" data-cfemail="15777a7a61666167746555213b233b25">[email protected]</a>/dist/css/bootstrap.min.css" integrity="sha384-B0vP5xmATw1+K9KRQjQERJvTumQW0nPEzvF6L/Z6nronJ3oUOFUFpCjEUQouq2+l" crossorigin="anonymous">
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/5.15.3/css/all.min.css" integrity="sha512-iBBXm8fW90+nuLcSKlbmrPcLa0OT92xO1BIsZ+ywDWZCvqsWgccV3gFoRBv0z+8dLJgyAHIhR35VZc2oM/gI1w==" crossorigin="anonymous" referrerpolicy="no-referrer"
/>
<table>
<tr class="tr_user_done hand_user_tasks" onclick="window.location='#';">
<td align="center" style="width: 30px;"><i class="fas fa-check text-success"></i></td>
<td>
<div class="TextSpanDone" data-hover="TEXT ON HOVER" style="width: 400px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis;">
<font style="font-size: 13px;"><b>Initial text</b><i class='fas fa-arrow-alt-circle-left fa-lg arrowbounce text-success hidearrowbounce'></i>
<DIV>
</td>
</tr>
</table>