Is there a way to set td
width by number of td
in a table. e.g:
- if there is 1
td
, then the width of eachtd
is 100% - if there is 2
td
, then the width of eachtd
is 50% - if there is 3
td
, then the width of eachtd
is 1/3 - etc.
Is there a way to write a CSS rule for this need?
Side note: I can not edit the HTML, it comes from somwhere else. I can only edit CSS.
The HTML could look like this:
<table>
<tr>
<td>foo</td>
<td>bar</td>
<td>baz<td>
</tr>
</table>