User:Taka/Tooltips

Intro
Tooltips can show additional information. On the Dutch wikipedia, i did an experiment with stylesheet based tooltips. It does not work in Internet Explorer, but it does work (with some glitches) in Mozilla/Firefox. This page is to explain and demonstrate it on the English wikipedia.
The idea is based on this website: http://psacake.com/web/jl.asp
Stylesheet
To make it work, it is required to make an adaption to your personal stylesheet (that can be done at User:YourName/standard.css or User:YourName/monobook.css or whatever style you have selected in your preferences.
/* start tooltip code */
div.info {
z-index:24; /*required */
position:relative; /*required */
background-color:yellow; /*use any color you like */
cursor:help /*optional, or use another cursor */
}
div.info:hover {
z-index:25; /*required */
background-color:pink /*use any color you like */
}
div.info:hover div.urlexpansion {
display:block; /*required */
position:absolute; /*required */
/*border and size specifications, change as you like */
top:2em;
left:2em;
width:15em;
/* colors, change as you like */
border:1px solid #0cf;
background-color:#cff;
color:#000;
}
/* end tooltip code */
Quick test if it works
I might create a demo from the text of a real article to demonstrate how it would look like there.
Technical problems
- It does not work in Internet Explorer, and it won't work in Internet Explorer. It uses the hover pseudoclass on a div element, which is not supported in Internet Explorer. IE supports hover only on an a element.
- http://dean.edwards.name/IE7/ can be a hackish solution to that.
- The title of internal links shows over the tooltip as created by this method, and makes it partly unreadable. That can't be solved using CSS, but it might be solved using javascript.
- The printable version of the page shows the text of the tooltips as normal text, inline with the rest. This method uses a CSS class (urlexpansion) meant for printing, which really shouldn't be done. But there wasn't any other way for this demonstration.
- The tooltip runs out of the visible page when the marked word is located at the righthand of the page.
Also it hasn't been tested with more complicated pages, with tables, images etc.
How is it done
1. Put the whole text of an article in a div.
2. Use this code:
<div class="info" style="display:inline;">visible text<div class="urlexpansion">text of the tooltip</div></div>
template
Somebody made a template, this is to show (if) how it works.
move mouse over
expect a longer comment on this line
Content Disclaimer
Informasi ini disarikan dari Wikipedia dan disajikan kembali untuk tujuan edukasi. Konten tersedia di bawah lisensi CC BY-SA 3.0. Kami tidak bertanggung jawab atas ketidakakuratan data yang bersumber dari kontribusi publik tersebut.
- The information displayed on this website is sourced in part or in whole from Wikipedia and has been adapted for the purpose of restating it. We strive to provide accurate and relevant information, however:
- There is no guarantee of absolute accuracy. Wikipedia is an open, collaborative project that can be edited by anyone, so information is subject to change.
- It is not intended to constitute professional advice. The content displayed is for informational and educational purposes only. For important decisions (e.g., medical, legal, or financial), please consult a professional.
- Content copyright. Wikipedia is licensed under the Creative Commons Attribution-ShareAlike License (CC BY-SA). This means that content may be reused with appropriate attribution and shared under a similar license.
- Responsible use. Any risk arising from the use of information from this website is entirely the responsibility of the user.