I'm a beginner in html css and I have created a speech bubble that appears when you hover over an element . My problem is that the speech bubble points to the bottom instead of my element as is shown in the pic below . I want the arrow to point to my element so that I can follow it and move my mouse on the speech bubble
A small code demo below using text instead of my image :
function showinfo(id){
if(id=="Patmos") document.getElementById("pat-info").style.visibility="visible";
}
function noinfo(id){
if(id=="Patmos"){
document.getElementById("pat-info").style.visibility="hidden";
}
}
.speech-bubble{
visibility: hidden;
}
.speech-bubble::after{
content: "";
position: relative;
margin-left: -5px;
border-width: 10px;
border-style: solid;
border-color: #555 transparent transparent transparent;
}
#pat-info{
position:absolute;
width: 120px;
background-color: #555;
color: #fff;
text-align: center;
border-radius: 6px;
padding: 5px 0;
z-index:1;
top:25px;
left:-40px;
}
<a href="#" id="Patmos" onmouseout="noinfo(this.id)" onmouseover="showinfo(this.id)"> I am text </a>
<span class="speech-bubble" id="pat-info"> Info </span>
In other words I want my text bubble arrow to point to my text so that I can follow it and move my mouse over the speech bubble since I want to add links and buttons on it later . I would appreaciate your help with this . Thank you in advance .
