Previous Message
Next Message

Contextual selector plus explicit class

Sent by Adam Kuehn on 15 March 2006 23:11


James Eaton wrote:
>What are the rules regarding contextual selectors used in combination with
>explicit class declarations?  I'm trying to use something like the
>following, but a class set in the <td> element has no effect (in Firefox
>and IE6):
>
>.stats td {
>   padding: 2px;
>   }
>.calign {
>   text-align: center;
>   }
></style>
>
><table class="stats">
>   <tr>
>     <th>Score</th>
>     <td class="calign">725</td>
>   </tr>
></table>


The selector .stats td has specificity [1] of 0,0,1,1.  The selector 
..calign has specificity of 0,0,1,0.  In other words, the first 
selector is "winning", and your second selector is not getting applied.

Try using .stats td.calign as your selector, instead.  This has 
specificity of 0,0,2,1 and should therefore solve your problem 
(assuming I have understood the issue correctly).

1. <http://www.w3.org/TR/CSS21/cascade.html#specificity>

HTH,


-Adam Kuehn 

______________________________________________________________________
css-discuss [EMAIL-REMOVED]]
http://www.css-discuss.org/mailman/listinfo/css-d
IE7b2 testing hub -- http://css-discuss.incutio.com/?page=IE7
List wiki/FAQ -- http://css-discuss.incutio.com/
Supported by evolt.org -- http://www.evolt.org/help_support_evolt/
Previous Message
Next Message

Message thread: