¿Cómo combinar estilo de clase y en línea

  • lzr
  • Novice
  • Novice
  • No Avatar
  • Registrado: May 09, 2008
  • Mensajes: 28
  • Status: Offline

Nota Abril 15th, 2010, 10:02 am

¡Hola!
He especificado una cierta clase en un archivo CSS externo (básicamente se trata de colores y alineaciones, para ser utilizados en un células tablas). En los casos en particular, quiero también para especificar las dimensiones de las células que las distintas células se diferencian por el uso de estilo en línea:
Código: [ Select ]
<td class="cell" style="width:100px;">

No parece que el trabajo todos los atributos de la clase son totalmente ignorados cuando hay estilo en línea.
¿Hay una manera de combinar la clase y estilo en línea?
  • Anonymous
  • Bot
  • No Avatar
  • Registrado: 25 Feb 2008
  • Mensajes: ?
  • Loc: Ozzuland
  • Status: Online

Nota Abril 15th, 2010, 10:02 am

  • tastysite
  • Proficient
  • Proficient
  • Avatar de Usuario
  • Registrado: Abr 09, 2008
  • Mensajes: 349
  • Loc: Brighouse, West Yorkshire, England
  • Status: Offline

Nota Abril 15th, 2010, 11:10 am

No, no los estilos en línea tienen que ser encerrados en etiquetas Creo que, al igual que
Código: [ Select ]
<style>td .cell{width:100px;}</style>
^__^
  • graphixboy
  • Control + Z
  • Mastermind
  • Avatar de Usuario
  • Registrado: Jul 11, 2005
  • Mensajes: 1828
  • Loc: In the Great White North
  • Status: Offline

Nota Abril 15th, 2010, 1:43 pm

No, no tienen que ser separados. El código OP trabajará sin embargo es necesario comprender las cuestiones de herencia. estilos de línea siempre prevalecerá sobre estilos vinculados significado en el ejemplo siguiente:

HTML Código: [ Select ]
<style>
   .example {background:blue;}
</style>
<div class="example" style="background:red;">content</div>
 
  1. <style>
  2.    .example {background:blue;}
  3. </style>
  4. <div class="example" style="background:red;">content</div>
  5.  


Su fondo div sería rojo. Generalmente, usted puede anular esta progresión mediante el atributo! Importantes en su estilo vinculadas

HTML Código: [ Select ]
<style>
   .example {background:blue !important;}
</style>
<div class="example" style="background:red;">content</div>
 
  1. <style>
  2.    .example {background:blue !important;}
  3. </style>
  4. <div class="example" style="background:red;">content</div>
  5.  


produciendo así un div azul.

Más información del El W3C
If at first you don't succeed F1... If that doesn't work try Google!
//// Designer, Developer & Teacher - Interactive, Motion and 3D \\\\
Portfolio at WhenImNotSleeping.com
  • joebert
  • Sledgehammer
  • Genius
  • No Avatar
  • Registrado: Feb 10, 2004
  • Mensajes: 13455
  • Loc: Florida
  • Status: Offline

Nota Abril 16th, 2010, 1:31 am

Quote:
No parece que el trabajo todos los atributos de la clase son totalmente ignorados cuando hay estilo en línea.


Esto me hace creer tu tienes un error de sintaxis en el código HTML, o un partido inesperado con otra selección. Nunca he oído hablar de algo así como el youve explicó ocurriendo en cualquier otra circunstancia y no puedo reproducirlo con una página de prueba simplificados.

HTML Código: [ Select ]
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
   <title>Title</title>
   <meta http-equiv="content-type" content="text/html;charset=utf-8" />
   <meta http-equiv="Content-Style-Type" content="text/css" />
   <link rel='stylesheet' type='text/css' href='style.css' />
</head>
<body>
   <div>
   <table cellspacing="10" cellpadding="10">
      <tr>
         <td class="cell">One</td>
         <td class="cell" style="width:100px;">Two</td>
      </tr>
   </table>
   </div>
</body>
</html>
  1. <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
  2. <html>
  3. <head>
  4.    <title>Title</title>
  5.    <meta http-equiv="content-type" content="text/html;charset=utf-8" />
  6.    <meta http-equiv="Content-Style-Type" content="text/css" />
  7.    <link rel='stylesheet' type='text/css' href='style.css' />
  8. </head>
  9. <body>
  10.    <div>
  11.    <table cellspacing="10" cellpadding="10">
  12.       <tr>
  13.          <td class="cell">One</td>
  14.          <td class="cell" style="width:100px;">Two</td>
  15.       </tr>
  16.    </table>
  17.    </div>
  18. </body>
  19. </html>


CSS Código: [ Select ]
.cell {background:#f00; color:#0f0;}


¿Puede publicar un versión más completa del código infractor, y tenga en cuenta que los navegadores que busca en ella con?
Strong with this one, the sudo is.
  • lzr
  • Novice
  • Novice
  • No Avatar
  • Registrado: May 09, 2008
  • Mensajes: 28
  • Status: Offline

Nota Abril 16th, 2010, 6:47 am

joebert escribió:
Esto me hace creer tu tienes un error de sintaxis en el código HTML, o un partido inesperado con otra selección. Nunca he oído hablar de algo así como el youve explicó ocurriendo en cualquier otra circunstancia y no puedo reproducirlo con una página de prueba simplificados.


Tiene usted razón, Ive encontrado un error en mi guión. Lo siento por perder su tiempo los chicos sobre este tema.

Publicar Información

  • Total de mensajes en este tema: 5 mensajes
  • Usuarios navegando por este Foro: No hay usuarios registrados visitando el Foro y 83 invitados
  • No puede abrir nuevos temas en este Foro
  • No puede responder a temas en este Foro
  • No puede editar sus mensajes en este Foro
  • No puede borrar sus mensajes en este Foro
  • No puede enviar adjuntos en este Foro
 
 

© 2011 Unmelted, LLC. Ozzu® es una marca registrada de Unmelted, LLC