the question is answered here: How to change the style of Title attribute inside the anchor tag?
alternatively, you should use a javascript library (there are several of them) like https://jqueryui.com/tooltip/
I think you should also add the aria-label attribute to ensure accessibility.
Can you use scss to have the same style? Something like that?
@mixin myclassforspan{
background:blue;
color:white;
padding:10px 2px;
}
.span_class[title] {
@include myclassforspan;
&:hover{
position: relative;
&:after{
@include myclassforspan;
content: attr(title);
position: absolute;
left: 0;
top: 100%;
z-index: 20;
}
}
}