This trick is presumably heavily deprecated but still widely used on all public wikis. T26529: Incrementally remove support for HTML elements removed from or deprecated in HTML5
<table style="width:100%; background:transparent;" cellspacing="0" cellpadding="0">
Such a bad mixture of HTML3 and HTML5 usually works somewhat, but this is probably dependent of "goodwill" of maintainers of web browsers. Minor color inconsitencies can be observed.
There is the "modern" syntax with "padding:5px 3px;". Unfortunately it is (as opposed to "cellpadding=5") NOT inherited from <table> to <td>. It must be repeated for every cell, making an automatic mass migration impossible, and increasing code complexity as well as pre-expand bloat and post-expand bloat. This is not sane. Unsuprisingly people stick with "cellpadding=" then.
How to fix this?
.# Immediately remove support for "cellpadding=" and other HTML3 tricks. This will give more consistent HTML output, but break 10'000's templates on all wikis.
.# Do nothing. This will not break anything now, but exports the responsibitity to the maintainers of web browsers who can break many wikis at any time in an uncontrolled manner.
.# Create a new private HTML-like element, let's call it "tddefault" allowing such syntax:
<table style="float:right;"> <tr> <tddefault style="background-color:#DDEEFF; border:2px solid #AAAAFF; padding:0.1em; text-align:center;"> <td>ABCD</td> <td>WXYZ</td> </tddefault> </tr> </table>
which would be converted to:
<table style="float:right;"> <tbody> <tr> <td style="background-color:#DDEEFF; border:2px solid #AAAAFF; padding:0.1em; text-align:center;">ABCD</td> <td style="background-color:#DDEEFF; border:2px solid #AAAAFF; padding:0.1em; text-align:center;">WXYZ</td> </tr> </tbody> </table>
This would avoid both pre-expand bloat and post-expand bloat, but still increase size of the generated HTML. And most notably, this would allow automatic mass-migration of templates with subsequent removal of support for HTML3.
.# Allow to use <style> with inline CSS from templates by means of a parser function or LUA function, or enhance <templatestyles> to allow inline definitions instead of a separate CSS file with all its risks and flaws (wrong protection level, bad edits, separation or loss, ...).