Ver Mensaje Individual
  #1 (permalink)  
Antiguo 31/08/2012, 11:29
Caminantejm
 
Fecha de Ingreso: julio-2009
Mensajes: 75
Antigüedad: 14 años, 9 meses
Puntos: 2
Posición relativa de tooltip con css

Tengo un problema ya varios días y no consigo resolverlo.
- Según el código css, el tooltip debería aparecer a continuación del nombre del curso como así sucede -extrañamente y por un vez- en IE8. No así en Mozilla que lo coloca en la posición top:0 y left:0. El contenedor tiene posición relativa y parece que todo está bien. He probado de muchas maneras y no lo consigo.

- Lo he resuelto adjudicando un top y left, pero ya no es igual pues lo que quiero es que lo resuelva con auto, que para eso está.

- A veces, cuando se le ocurre, sí que lo resuelve bien. Pero es aleatorio. Por ejemplo, si quito una fila quizás resuelva bien. ¿?

---> He puesto todo el código pero el problema está en title
---> Si quito elementos div o table también resuelve mejor. Pero no entiendo la razón. Por eso he puesto todo el código.

Saludos y gracias de antemano.
Caminantejm.
Código HTML:
Ver original
  1. <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
  2. "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
  3.  
  4. <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="es" lang="es">
  5. <link rel="stylesheet" href="error.css" type="text/css">
  6. <script language="javascript" type="text/javascript" src="abreventana.js"></script>
  7. </head>
  8. <body style="font-family: Arial; font-size: 10pt; text-align:left" text="#800000" bgcolor="#CC9900" background="fondoflores2t-25.jpg">
  9.  
  10. <div align="center">
  11.     <table border="0" width="770" cellspacing="7" cellpadding="0" id="table2">
  12.         <tr>
  13.             <td>
  14.             <p align="center">
  15.             <?php
  16.             include ('fotos_aleatorias.php');
  17.             ?>
  18.             </td>
  19.         </tr>
  20.     </table>
  21. </div>
  22. <div align="center">
  23.         <table border="0" width="770" cellspacing="0" cellpadding="10" id="table3">
  24.             <tr>
  25.                 <td>
  26.                
  27.     <div class="hovermenu">
  28.     <ul>
  29.     <li><a href="index.php">Inicio</a></li>
  30.     <li><a href="presenta2.php">Presentación</a></li>
  31.  
  32.     <li><a href="formacion2.php">Formación</a></li>
  33.     <li><a id="current" href="calendario2.php">Calendario</a></li>
  34.     <li><a href="noticias2.php">Noticias</a></li>
  35.     <li><a href="crecer2.php">Aportaciones</a></li>
  36.  
  37.     <li><a href="direccion2.php">Dirección</a></li>
  38.     </ul>
  39.     </div>
  40.                 </td>
  41.             </tr>
  42.         </table>
  43.        
  44. </div>
  45. <div align="center">
  46.     <table border="0" width="770" cellspacing="7" cellpadding="7" id="table1">
  47.  
  48.         <tr>
  49.             <td width="770" background="fonfloverde-2t-24-7.jpg">
  50.  
  51. <!-- Comienza tabla limpia -->         
  52.    
  53. <table class="contenido">
  54.         <tr class="cabecera">
  55.     <th>FECHA</th>
  56.     <th>CURSO<br/><span class="miniatura"><b>Nota:</b>&nbsp;Ratón sobre el título<br/>muestra
  57.                     presentación del curso.</span></th>
  58.     <th>ORIENTA</th>
  59.     <th>LUGAR</th>
  60.     <th>ORGANIZA</th>
  61.     </tr>
  62. <!-- 24 -->
  63.         <tr class="normal">
  64.     <td>Septiembre -23-</td>
  65.     <td><div class="anual">
  66.         Comienzo del curso anual:<br/><a style="z-index: 24;" class="titleazul">"<b>Práctica</b>"
  67. <span><img border="0" src="arrow_r_white022.gif">&nbsp;<b>Presentación:</b><br/>
  68. &nbsp;&nbsp;&nbsp;Es un tema
  69. </span></a>
  70.         </div>     
  71.                                                                                     </td>
  72.     <td>curso</td>
  73.     <td>curso</td>
  74.     <td>curso</td>
  75.     </tr>
  76. <!-- 23 -->
  77.         <tr class="normal">
  78.     <td>Septiembre</td>
  79.     <td><div class="anual">
  80.         Comienzo del curso anual:<br/><a style="z-index: 23;" class="titleazul">Grupo 1: "<b>Ciclo ADN</b>"
  81. <span><img border="0" src="arrow_r_white022.gif">&nbsp;<b>Presentación:</b><br/>
  82. &nbsp;&nbsp;&nbsp;Es un tema
  83. </span></a><br/> <!-- Atención este <br/> -->
  84.        
  85. <!-- 21 -->
  86.     <a style="z-index: 21;" class="titleazul">Grupo 5: "<b>Motor</b>"
  87. <span><img border="0" src="arrow_r_white022.gif">&nbsp;<b>Presentación:</b><br/>
  88. &nbsp;&nbsp;&nbsp;Son dos temas
  89. </span></a>
  90.         </div>
  91.                                                                                         </td>
  92.     <td>curso</td>
  93.     <td>curso</td>
  94.     <td>curso</td>
  95.     </tr>
  96. <!-- 20 -->
  97.         <tr class="normal">
  98.     <td>Septiembre</td>
  99.     <td><div class="anual">
  100.     Comienzo del curso anual:<br/><a style="z-index: 20;" class="titleazul">
  101.         "<b>Las ruedas</b>"
  102. <span><img border="0" src="arrow_r_white022.gif">&nbsp;<b>Presentación:</b><br/>
  103. &nbsp;&nbsp;&nbsp;Es un tema
  104. </span></a>
  105.         </div>                                                                                      </td>
  106.     <td>curso</td>
  107.     <td>curso</td>
  108.     <td>curso</td>
  109.     </tr>
  110. <!-- 19 -->
  111.         <tr class="normal">
  112.     <td>Septiembre</td>
  113.     <td><a style="z-index: 19;"class="title">"<b>Mi trabajo</b>"
  114. <span><img border="0" src="arrow_r_white022.gif">&nbsp;<b>Presentación:</b><br/>
  115. &nbsp;&nbsp;&nbsp;Es un tema
  116. </span></a>
  117.                                                                                         </td>
  118.     <td>curso</td>
  119.     <td>curso</td>
  120.     <td>curso</td>
  121.     </tr>
  122. <!-- 18 -->
  123.         <tr class="normal">
  124.     <td>Octubre</td>
  125.     <td><a style="z-index: 18;" class="title">"<b>Introducción a la biología.</b>"
  126. <span><img border="0" src="arrow_r_white022.gif">&nbsp;<b>Presentación:</b><br/>
  127. &nbsp;&nbsp;&nbsp;Es un tema
  128. </span></a>
  129.                                                                                         </td>
  130.     <td>curso</td>
  131.     <td>curso</td>
  132.     <td>curso</td>
  133.     </tr>
  134. <!-- 16 -->
  135.         <tr class="normal">
  136.     <td>Diciembre</td>
  137.     <td><a style="z-index: 16;" class="title">"<b>La atmósfera</b>"
  138. <span><img border="0" src="arrow_r_white022.gif">&nbsp;<b>Presentación:</b><br/>
  139. &nbsp;&nbsp;&nbsp;Es un tema
  140. </span></a>
  141.                                                                                         </td>
  142.     <td>curso</td>
  143.     <td>curso</td>
  144.     <td>curso</td>
  145.     </tr>
  146. <!-- 15 -->
  147.         <tr class="normal">
  148.     <td>Enero</td>
  149.     <td><a style="z-index: 15;" class="title">"<b>Mesas</b>"
  150. <span><img border="0" src="arrow_r_white022.gif">&nbsp;<b>Presentación:</b><br/>
  151. &nbsp;&nbsp;&nbsp;Es un tema
  152. </span></a>
  153.                                                                                     </td>
  154.     <td>curso</td>
  155.     <td>curso</td>
  156.     <td>curso</td>
  157.     </tr>
  158. <!-- 14 -->
  159.         <tr class="normal">
  160.     <td>Febrero</td>
  161.     <td><a style="z-index: 14;" class="title">"<b>Ayuda</b>"
  162. <span><img border="0" src="arrow_r_white022.gif">&nbsp;<b>Presentación:</b><br/>
  163. &nbsp;&nbsp;&nbsp;Es un tema
  164. </span></a>
  165.                                                                                     </td>
  166.     <td>curso</td>
  167.     <td>curso</td>
  168.     <td>curso</td>
  169.     </tr>
  170.    
  171. <!-- Termina tabla limpia -->          
  172.             </td>
  173.         </tr>
  174.     </table>
  175. </div>
  176. </body>
  177. </html>


Código CSS:
Ver original
  1. body {color: #ffffcc; margin: auto;}
  2.  
  3. a  {              /*   Se elimina subrayado en enlaces  -Volver-*/
  4.     text-decoration: none;
  5.     color: maroon;
  6. }
  7.  
  8. .title { position: relative;
  9. z-index: 0;
  10. }
  11.  
  12.  
  13. .title:hover { background-color: transparent;  /* transparent  */
  14. color: #be00bf;
  15. z-index: 1;
  16. }
  17.  
  18. .title span {border: 1px solid white;
  19. padding: 5px;
  20. position: absolute;
  21. text-decoration: none;
  22. background-color: #bc00bd;
  23. color: white;
  24. width: 34em;
  25. text-align: left;
  26. visibility: hidden;
  27. font-size: 0.9em;
  28. line-height: 16px;
  29. }
  30.  
  31. .title:hover span { visibility: visible;
  32. top: auto; /*1.3em */
  33. left: auto;  /*10em */   /* 4px va en la vertical: 25px se adentra un poco*/
  34. }
  35.  
  36.  
  37.  
  38. /* title es el más numeroso */
  39.                /* title2 - inmediato debajo de última línea*/
  40. /* con tiempo hay que investigar la colocación de <br/> para evitar dos title*/
  41.  
  42.  
  43. /* titleazul*/
  44.  
  45. .titleazul { position: relative;
  46. z-index: 0;
  47. }
  48.  
  49. .titleazul:hover { background-color: transparent;  /* transparent */
  50. color: blue;
  51. z-index: 1;
  52. }
  53.  
  54. .titleazul span { border: 1px solid white;
  55. padding: 5px;
  56. position: absolute;
  57. text-decoration: none;
  58. background-color: blue; /* #bffeff */
  59. color: white;  /* #3E1F00 */
  60. width: 30em; /* 35em */
  61. text-align: left;
  62. visibility: hidden;
  63. font-size: 0.9em;
  64. line-height: 16px;
  65. }
  66.  
  67. .titleazul:hover span { visibility: visible;
  68. top: auto; /*1.3em*/ /*20px*/ /*auto: superior parent*/
  69. left: auto;  /*10em*/ /*150px*/ /*auto: final del texto o de dcha. imagen*/
  70. }
  71.  
  72. /* titleazul2 El 29-08-2012 no hay ninguno. */
  73.  
  74. /*------------------ tabla principal -----------------------*/
  75.  
  76. table.contenido {border: 4px double #6b8e23;
  77. border-collapse: collapse;
  78. border-spacing: 10px 5px; /*no tiene sentido con collapse */
  79. color: maroon;
  80.     width: 800px;
  81.     background-image: url(fonfloverde-2t-24-7.jpg);
  82. }
  83.  
  84. tr.cabecera {height: 60px;
  85. background-image: url(alfa40.png);}
  86.  
  87. .contenido td, th {border: 1px solid #556b2f;
  88.     font-weight: bold;
  89.     padding: 5px;  
  90. }
  91.  
  92. .normal td, .normal td a {font-weight: normal;
  93. color: #336600;
  94. line-height: 1.5;}
  95.  
  96. .miniatura {color: #996633;font-family: Verdana;
  97. font-size: 7pt;font-weight: normal;
  98. }
__________________
Gracias de antemano por la ayuda.
Saludos.
Caminantejm.

Última edición por Caminantejm; 31/08/2012 a las 12:04