Esther van Summeren wrote:
> I am realizing a skin for an oldschool html website in which I can't
> modificate anything but the CSS.
Sounds rather frustrating.
> I need to apply a background-color to a cell or its mother table, but
> I'm not sure if there's a way to achieve that:
The table contains just one cell containing an image, so it's something that
we would write as a simple styled <div> element these days. It's far less
evident what to do if you're really trying to modify the appearance without
rewriting the markup and cannot even add a class attribute.
> The problem is that the only specific thing about this cell is that
> it's containing an image.
You can't construct a selector for a cell (or table) based on that. It might
be something useful, and might be added to specifications and implemented
some day, but that's a different story.
> I tried to reverse the point of view and applied a
>
> body > table > tr > td > table {background: .....}
>
> but the problem is that on other pages there might be three tables
> preceding the final table I'd like to paint.
I'm not sure I follow the logic here. A selector of the form x > y matches a
y that is a direct descendant of an x, and your sample code has a table
containg a tbody containing a tr containing a td, with no hint to any
nesting of tables, so I don't see how the rule above could work.
Moreover, since IE 6 and older don't understand selectors of the form x > y,
the approach would fail in most browsing situations now anyway.
> Would there be any smart trick for this situation?
I'm afraid not, unless the table appears inside an element that could be
used to distinguish it from other tables.
Jukka K. Korpela ("Yucca")
http://www.cs.tut.fi/~jkorpela/
______________________________________________________________________
css-discuss [EMAIL PROTECTED]
http://www.css-discuss.org/mailman/listinfo/css-d
List wiki/FAQ -- http://css-discuss.incutio.com/
List policies -- http://css-discuss.org/policies.html
Supported by evolt.org -- http://www.evolt.org/help_support_evolt/