- From: Sandy Smith <ssmith@forumone.com>
- Date: Fri, 5 Dec 2003 14:36:27 -0500 (EST)
- To: Boris Zbarsky <bzbarsky@MIT.EDU>
- Cc: www-style@w3.org, Jason Lefkowitz <jlefkowitz@forumone.com>
On Dec 5, 2003, at 12:28 PM, Boris Zbarsky wrote: > Sandy Smith wrote: >> http://ln.hixie.ch/?start=1070385285&count=1 >> This is a total off-the-top-of-my-head idea but what about building >> in a CSS accessor for the TD element's "header" property? That way as >> a table cell is being evaluated, a property like: >> td::header#myColumn { color: red } >> ...would take precedence over any definition for a TR element. > > How would this work exactly? That is, how would this be used in an > actual document? > > -Boris > OK, my colleague, Jason Lefkowitz, and I have done a little more research, and this is currently supported in Mozilla and Safari, but not in IE (Mac or PC): Example document: <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/2000/REC-xhtml1-20000126/DTD/xhtml1-strict.dtd"> <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en"> <head> <meta http-equiv="content-type" content="text/html; charset=utf-8" /> <title>Untitled</title> <style type="text/css"> /* <![CDATA[ */ tr.data { color: blue } td[headers~=myColumn] { color: red } td.specialCell { background-color: black } /* ]]> */ </style> </head> <body> <table> <tr> <th id="myColumn">Red Text in This Column</th> <th>Data</th> </tr> <tr class="data"> <td headers="myColumn">this text is red</td> <td>This text is blue</td> </tr> <tr class="data"> <td headers="myColumn" class="specialCell">this text is red, too</td> <td>This text is still blue</td> </tr> </table> </body> </html> Obviously you could achieve the same effect with a normal class, but this way you can use a class for other things, and it has a slight semantic meaning. And, if I understand the original article's problem statement correctly, it overcomes the problem of rows taking precedence to the <col> element and is be rendered at the appropriate point. Another drawback is that with only a single statement, you couldn't define the column with the traditional box model properties applied to the column as a whole. Plus there's the "IE doesn't support it" problem, whereas a class would work across browsers. -- Sandy Smith, Senior Programmer Forum One Communications, Inc. ssmith@forumone.com tel. 703-548-1855 x28 http://www.forumone.com/
Received on Monday, 8 December 2003 05:16:15 UTC