Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

tooltip box not showing using css

Tags:

css

tooltip

I am trying to show a tool tip box on hover an image. I won't be able to use jquery or any other plugin. I have to use pure css. I have seen a demo working here.

http://netdna.webdesignerdepot.com/uploads7/how-to-create-a-simple-css3-tooltip/tooltip_demo.html

My code:

<a class="tooltip" title="This is some information for our tooltip." href="#"><img id="graph_one" alt="" src="https://www.onlandscape.co.uk/wp-content/uploads/2013/09/Doug-Chinnery-ICM-Images-4-45x45.jpg" class="graph one">  </a>

Jsfiddle :

http://jsfiddle.net/txeF2/

For some reason I can't get the tooltip box.

UPDATED : http://jsfiddle.net/Md5E6/4/

like image 870
Prithviraj Mitra Avatar asked Oct 31 '25 01:10

Prithviraj Mitra


1 Answers

Here is one solution: EXAMPLE HERE

Change .tooltip from inline to inline-block:

.tooltip {
    display: inline-block;
    position: relative;
}

Then remove the absolute positioning from the child img element. This was causing the main problem; as the element was removed from the flow of the document, thus causing the parent element to have no dimensions and collapse upon itself.

like image 195
Josh Crozier Avatar answered Nov 01 '25 15:11

Josh Crozier



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!