Hi

I must be wrong, because it’s surely a basic feature, but it seems that it
is not possible to define a selector which matches elements which *don’t*
have a particular attribute.

I am taking HTML which contains alignment attributes on table cells where
the originating software considers this appropriate, e.g.

  <table>
   <caption>This is a table</caption>
   <tr>
    <th align="center">heading</th>
    <th>heading</th>
   </tr>
   <tr>
    <td align="center">data</td>
    <td>data</td>
   </tr>
   <tr>
    <td>data</td>
    <td align="right">data</td>
   </tr>
  </table>

The alignment attributes are generated with the assumption that all table
cells and headings are left-aligned by default, but this leads to an issue
with the default behaviour of IE (which is to left-align <td> elements, but
center <th> elements).

So I want to style this with something like

  tr[^align], th[^align] {
    text-align: left;
  }
  tr[align], th[align] {
    text-align: attr(align);
  }

where the [^align] piece means select elements which do NOT have an align
attribute. There doesn't seem to be such a construct in CSS.

Two and a half questions:
1. Is there a construct which I can use for an undefined attribute?
2. Is it valid to define text-align: attr(align) as in the code above? All
the examples I have seen restrict the use of attr() to defining "content:".

The half question:
a. If the answer to both the foregoing is No, how would you recommend coding
this requirement in CSS?


Cheers
T
 
Trevor Nicholls
Casting the Void


______________________________________________________________________
css-discuss [EMAIL PROTECTED]
http://www.css-discuss.org/mailman/listinfo/css-d
IE7 information -- 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/

Reply via email to