Hello Im adding some images an using a tooltip animation on hover, I have used the same setup in react and vanilla js. Im currently using Angular 2 and for some reason my spans nor images will show up, I know im using the correct path because if i put the image outside the container span it shows the image.
div >
<div>
<div >
<span data-tooltip="sometext">
<img alt="icon" src='assets/images/img.png'/>
</span>
</div>
css
tooltip {
position: relative;
padding: 5px 12px;
margin: 5px;
font-size: 15px;
border-radius: 100%;
color: #FFF;
font-family: 'Kanit', sans-serif;
}
.tooltip:before,
.tooltip:after {
position: absolute;
content: '';
opacity: 0;
transition: all 0.4s ease;
}
.tooltip:before {
border-width: 10px 8px 0 8px;
border-style: solid;
border-color: grey transparent transparent transparent;
top: -130px;
left: 75px;
transform: translateY(20px);
}
.tooltip:after {
content: attr(data-tooltip);
background: grey;
width: 160px;
height: 40px;
font-size: 30px;
font-weight: 300;
top: -190px;
left: -10px;
padding: 10px;
border-radius: 5px;
letter-spacing: 1px;
text-align: center;
transform: translateY(20px);
}
.tooltip:hover::before,
.tooltip:hover::after {
opacity: 1;
transform: translateY(-2px);
}
@keyframes shake {
0% {
transform: rotate(2deg);
}
50% {
transform: rotate(-3deg);
}
70% {
transform: rotate(3deg);
}
100% {
transform: rotate(0deg);
}
}
.skillz:hover {
animation: shake 500ms ease-in-out forwards;
}
CodePudding user response:
Figured it out, I have bootstrap installed and I couldnt use the tooltip class.