My problem is that I can't really position a tooltip tail properly. I have a plugin that generates hints, which can be positioned in 4 different places: top, bottom, left, right. I need the tail to be positioned in the center top/left/bottom/right of each hint.
I tried using css like that:
.ui-hint{
display: block;
position: absolute;
min-width: 50px;
max-width: 200px;
min-height: 25px;
background: #FDD10B;
padding: 15px;
color: #000000;
font-size: 16px;
-webkit-border-radius: 5px;
-moz-border-radius: 5px;
border-radius: 5px;
}
.ui-hint-left:before{
position: absolute;
z-index: 9998;
content: '';
display: block;
width: 0;
height: 0;
border-top: 15px solid transparent;
border-left: 20px solid #FDD10B;
border-bottom: 15px solid transparent;
right: -15px;
top: 25%;
}
.ui-hint-right:before{
position: absolute;
z-index: 9998;
content: '';
display: block;
width: 0;
height: 0;
border-top: 15px solid transparent;
border-right: 20px solid #FDD10B;
border-bottom: 15px solid transparent;
left: -15px;
top: 25%;
}
.ui-hint-top:before{
z-index: 9998;
position: absolute;
content: '';
display: block;
width: 0;
height: 0;
border-left: 15px solid transparent;
border-right: 15px solid transparent;
border-top: 20px solid #FDD10B;
left: 42%;
bottom: -15px;
}
.ui-hint-bottom:before{
z-index: 9998;
position: absolute;
content: '';
display: block;
width: 0;
height: 0;
border-left: 15px solid transparent;
border-right: 15px solid transparent;
border-bottom: 20px solid #FDD10B;
left: 42%;
top: -15px;
}
I works fine for standart height/width hints, but if they get larger, tooltips shift because of the messed up percentage rate. Maybe I can somehow make that using js/jquery (appending an element)? Will appreciate any input.