I am having difficulty styling a link's title using jQuery-mobile. Each link represents a player with unique abilities. When the user hovers over a player, I want a tooltip to display their special ability. Despite trying various code samples, none have been successful. My latest attempt can be found in this jsFiddle.
Here is the HTML markup for the link:
<li class="ui-btn-icon-left"><a class="tooltip" data-tooltip="Promising goalkeeper" href="#"><span>L_Oikonomo</span></a></li>
Below is the CSS code for the tooltip (excluding vendor prefixes):
/* tooltip body text */
.tooltip:hover:before {
display:block;
background:#eee;
background:linear-gradient(rgba(255, 205, 205, 0.9), rgba(228, 230, 230, 0.9));
content:attr(data-tooltip); /* this link attribute contains tooltip text */
position:absolute;
font-size:0.9em;
color:rgba(51, 51, 51, 0.9);
bottom:20px; /* ensure link text is visible under tooltip */
right:0px; /* align both tooltip and link right edges */
width:11em; /* a reasonable width to wrap tooltip text */
text-align:center;
padding:4px;
border:2px solid rgba(204, 153, 153, 0.9);
border-radius:6px;
box-shadow:-2px -2px 2px rgba(20, 20, 20, 0.4);
}
/* styles shared by both triangles */
.tooltip:hover span:before, .tooltip:hover span:after {
content:"";
position:absolute;
border-style:solid;
}
/* outer triangle: for border */
.tooltip:hover span:before {
bottom:5px; /* value = tooltip:hover:before (border-width*2)+1 */
right:40px; /* controls horizontal position */
border-width:16px 16px 0; /* top, right-left, bottom */
border-color:rgba(204, 153, 153, 0.9) transparent; /* top/bottom, right-left (lazy becasue bottom is 0) */
}
/* inner triangle: for fill */
.tooltip:hover span:after {
bottom:8px; /* value = tooltip:before (border-width*2) */
right:42px; /* above 'right' value + 2 */
border-width:14px 14px 0; /* 2 less than above */
border-color:rgba(225, 238, 238, 0.95) transparent; /* tweak opacity by eye/eyedropper to obscure outer triangle colour */
}
Is it possible to make this work? If not, do you have any other suggestions to style the link's title?