Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Make span visible on hover css

Tags:

html

css

hover

I have a problem with showing the span on the hover from my canvas. I have found a lot articles on Stack Overflow but I don't get it.

This is my html:

<section id="graphs">
    <span id="tooltip">thisistest</span>
    <canvas id="myChart" class="tooltip" width="550" height="350"></canvas>
</section>

and this 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;
}

1 Answers

I quickly made this fiddle. The main problem is your :hover statement. in the fiddle on line 22 of css.

http://jsfiddle.net/robbiebardijn/hDbq3/

#graphs:hover #tooltip
like image 144
Robbie Bardijn Avatar answered Jul 13 '26 21:07

Robbie Bardijn



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!