Bonjour,
J'ai une tooltip qui se positionne parfaitement pour les div (image) qui font 32px par 32px.
Si un div fait 16x16, la tooltip se décale vers le haut.
Un positionnement avec le javascript est peut être mieux ?
Exemple : Copier-coller ce code dans le bloc-note ou notepad, et enregistrer en essai.html
Ensuite voyez le problème par vous-même
Merci d'avances pour vos réponses
Code : Sélectionner tout - Visualiser dans une fenêtre à part
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76 <html> <head> <style type="text/css"> body { background-color: #bbb; text-align: center; font-family: tahoma; } .container { margin: 0 auto; width: 1000px; } img{ background-color: #eee; border: 1px solid #fff;} h1 { font-size: 20px;} a.tooltip { position: relative; display: inline-block; text-decoration: none; } .tooltip span.tooltip { background: url(http://www.web-astronomie.fr/images/bg-tooltip.png) repeat-x; border: 1px solid #333; visibility: hidden; position: absolute; white-space: nowrap; color: #fff; font-size: 11px; bottom: 45px; left: -5px; height: 17px; line-height: 15px; padding: 4px 7px; -moz-border-radius: 3px; } .tooltip:hover span.tooltip { visibility: visible; } .tooltip:hover span.tooltip span.arrow { background: url(http://www.web-astronomie.fr/images/top-tooltip.png) no-repeat; /* Flèche */ display: block; position: absolute; width: 9px; height: 6px; top: 23px; left: 16px; border: 0; } td a { margin: 10px; } </style> </head> <body> <div class="container"> <h1>Survolez les deux images</h1><br /><br /> <table> <tr> <td> <a href="#" class="tooltip"> <img src="http://www.web-astronomie.fr/images/fonction01.png" alt="" /> <span class="tooltip"><span class="arrow"></span>Créez votre propre blog</span> </a> </td> <td> <a href="#" class="tooltip"> <img src="http://www.web-astronomie.fr/images/fonction01-16x16.png" alt="" /> <span class="tooltip"><span class="arrow"></span>Créez votre propre blog</span> </a> </td> </tr> </table> <p>La tooltip ne s'ajuste pas automatiquement à la hauteur de l'image.</p> <p>Elle est automatiquement réglée à la hauteur : bottom: 45px;<br /> <p>J'aimerais que la tooltip s'ajuste à la hauteur de l'image<br /> Voir l'image ci-dessous :</p> <img style="border:0; display: block;margin: 0 455px;" src="http://www.web-astronomie.fr/images/image.png" alt="" /> </div> </body> </html>
Partager