Foros del Web » Creando para Internet » CSS »

Prioridad de Estilos

Estas en el tema de Prioridad de Estilos en el foro de CSS en Foros del Web. Que tal gente, tengo el siguiente código: @import url("http://static.forosdelweb.com/clientscript/vbulletin_css/geshi.css"); Código HTML: Ver original <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> < html xmlns = ...
  #1 (permalink)  
Antiguo 10/01/2013, 12:05
Avatar de CdG
CdG
 
Fecha de Ingreso: marzo-2008
Mensajes: 114
Antigüedad: 16 años, 2 meses
Puntos: 2
Prioridad de Estilos

Que tal gente,
tengo el siguiente código:
Código HTML:
Ver original
  1. <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
  2. <html xmlns="http://www.w3.org/1999/xhtml" lang="es">
  3. <style type="text/css">
  4. .campo {
  5.   float : left;
  6.   text-align : right;
  7. }
  8. <script type="text/javascript">
  9. function through(target) {
  10.   target.parentNode.parentNode.style.textDecoration = "line-through";
  11. }
  12. </head>
  13. <table border="1">
  14.   <tr>
  15.     <td>
  16.       <table border="1">
  17.         <tr>
  18.           <td>&nbsp;</td>
  19.           <td>&nbsp;</td>
  20.         </tr>
  21.       </table>
  22.     </td>
  23.   </tr>
  24.   <tr>
  25.     <td>
  26.       <table border="1">
  27.         <tr><!-- Aquí aplico el estilo -->
  28.           <td><div onclick="through(this);">campo1</div></td>
  29.           <td><div class="campo">campo2</div></td>
  30.         </tr>
  31.       </table>
  32.     </td>
  33.   </tr>
  34. </body>
  35. </html>
Lo que intento hacer es que al hacer click en campo1, le aplique a todas las celdas de esa misma tabla la propiedad line-through, osea que al tr que he comentado le agrego el estilo text-decoration:line-through;a través de la función through()
Todo funciona bien, pero al agregar a .campo la propiedad float : left, esa columna no toma el estilo asignado por la función. Por que?
Bueno, espero que se entienda, saludos y gracias.
__________________
no quiero ser un árbol y caminar
Jacinto Piedra
  #2 (permalink)  
Antiguo 10/01/2013, 15:38
Avatar de chicohot20  
Fecha de Ingreso: mayo-2009
Mensajes: 388
Antigüedad: 15 años
Puntos: 43
Respuesta: Prioridad de Estilos

Q Extraño!

Prueba así:
Código HTML:
Ver original
  1. <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
  2. <html xmlns="http://www.w3.org/1999/xhtml" lang="es">
  3. <style type="text/css">
  4. .campo {
  5.   float : left;
  6.   text-align : right;
  7. }
  8. .line-through div{text-decoration: line-through;}
  9. <script type="text/javascript">
  10. function through(target) {
  11.   target.parentNode.parentNode.setAttribute("class", "line-through");
  12. }
  13. </head>
  14. <table border="1">
  15.   <tr>
  16.     <td>
  17.       <table border="1">
  18.         <tr>
  19.           <td>&nbsp;</td>
  20.           <td>&nbsp;</td>
  21.         </tr>
  22.       </table>
  23.     </td>
  24.   </tr>
  25.   <tr>
  26.     <td>
  27.       <table border="1">
  28.         <tr><!-- Aquí aplico el estilo -->
  29.           <td><div onclick="through(this);">campo1</div></td>
  30.           <td><div class="campo">campo2</div></td>
  31.         </tr>
  32.       </table>
  33.     </td>
  34.   </tr>
  35. </body>
  36. </html>
  #3 (permalink)  
Antiguo 11/01/2013, 08:01
Avatar de CdG
CdG
 
Fecha de Ingreso: marzo-2008
Mensajes: 114
Antigüedad: 16 años, 2 meses
Puntos: 2
Respuesta: Prioridad de Estilos

perfecto! gracias
__________________
no quiero ser un árbol y caminar
Jacinto Piedra

Etiquetas: javascript
Atención: Estás leyendo un tema que no tiene actividad desde hace más de 6 MESES, te recomendamos abrir un Nuevo tema en lugar de responder al actual.
Respuesta




La zona horaria es GMT -6. Ahora son las 08:54.