URL: http://philevans.com/tabletest.html
A boring table, but one which illustrates my problem. I'm writing a
large PHP app which outputs data tables. Users of the app can configure
their preferences for table border width, colour, style etc . . . I
don't have access to the main stylesheet from the PHP, so the border for
the table is going inline, thus:
<table id="testTable" style="border: 1px dotted red;">
However, user specified borders need to apply to the table cells as well
as to the external border of the table itself. Initally I thought that I
could write
#testTable td { border: inherit}
in the main stylesheet (in the real app I'm actually inheriting from a
class .userStyledTable but the idea's the same), which didn't work; I
then realised that the cell would be trying to inherit from the tr and
the tbody, which have no borders. Adding
#testTable thead, #testTable th, #testTable tbody, #testTable tr,
#testTable td { border: inherit; }
makes things work as I want in Firefox, but not in IE6. Any ideas how I
can achieve what I want? To reiterate:
- I can write dynamic inline styles to the table easily
- I can't really write dynamic styles to the HTML head or the
stylesheet, since I don't know "in time" what styles I'll need, and it's
a lot of work to find out
- I can write any static styles I want (e.g. the border: inherit) to the
stylesheet
Any ideas or suggestions?