我有一个问题,无法在我的画布上悬停显示span。 我在Stack Overflow上找到了很多文章,但我不理解。
这是我的html:
<section id="graphs">
<span id="tooltip">thisistest</span>
<canvas id="myChart" class="tooltip" width="550" height="350"></canvas>
</section>
和这个 CSS:
//This part works
span#tooltip {
display: none;
position: relative;
top: 8px;
left: 10px;
padding: 5px;
margin: 10px;
z-index: 100;
background: #333;
border: 1px solid #c0c0c0;
opacity: 0.8;
width: 300px;
color: White;
text-align: left;
}
//This does not show the span...
canvas.tooltip:hover #tooltip {
display: block;
}