I try to use the approach for showing an HTML tooltip. I have already for some adaptions of the solution especially since the size didn't fit in properly. The working solution looks like
sup.footnote::after {
content: attr(data-count);
}
sup.footnote:hover {
cursor: help;
position: relative;
}
sup.footnote cite {
display: none;
}
sup.footnote:hover cite {
display: inline-block;
position: absolute;
top: 0px;
left: -50%;
width: 250px;
background: #f0f0f0 no-repeat 100% 5%;
border: #c0c0c0 1px dotted;
border-radius: 8px;
margin: 10px;
padding: 8px;
overflow: hidden;
}
sup.footnote cite a {
text-overflow: ellipsis;
white-space: nowrap;
overflow: hidden;
display: block;
}
<p> another line </p>
<p>
Dies ist ein Beispiel für eine Fußnote in HTML
<sup class="footnote" data-count="1">
<cite>
<span> [Sample span]</span> with some explanation:
<a lang="en" href="http://test.gv.at/test.pdf">
http://test.gv.at/test/test/abde4/iabcde/009909asdf/vandsfk23/verylong/gghhy.pdf
</a>
</cite>
</sup>
</p>
<p> another line </p>
In general this works quite good. My problem here is that depending on the entry of the mouse cursor the overlapping is too less. This causes the problem when trying to move the cursor into the displayed box the box vanishes before the cursor entered it.
In the demo the effect isn't that serious (try it from the left top corner). But in real life the hiding sux.
I tried several solutions with opacity
. This one looks quite promising but I couldn't stich them together properly. I guess that's due to the fact that display:none
is used.
Any idea what kind of CSS I should use to delay the hiding?