There are plenty of JavaScript-based libraries that show tooltips when you hover your mouse over a certain area of a web page. Some are rather plain, some allow the tooltip to display HTML content styled with CSS.
But is there a way to show a styled tooltip without using JavaScript? If you just use the title
attribute, tags are not processed (e.g. foo<br />bar
doesn't produce a line break). I'm looking for a solution that allows one to display styled HTML content without using any JavaScript.
Another similar way to do it by css:
Try it: http://jsfiddle.net/FdBu7/
And here is some links about transitions and new ways to do it: http://www.w3schools.com/css3/css3_transitions.asp http://dev.opera.com/articles/view/css3-show-and-hide/
Using the title attribute:
I have made a little example using
css
FIDDLE
http://jsfiddle.net/8gC3D/471/
This is my solution for this:
https://gist.github.com/BryanMoslo/808f7acb1dafcd049a1aebbeef8c2755
The element recibes a "tooltip-title" attribute with the tooltip text and it is displayed with CSS on hover, I prefer this solution because I don't have to include the tooltip text as a HTML element!
This one is very interesting,
Similar to koningdavid's, but works on display:none and block, and adds additional styling.