My current challenge involves altering the background-color of a parent <td>
element, without being able to directly modify the HTML structure. The software system utilized at my workplace strictly relies on SQL queries for data manipulation and generation of HTML tables that are then automatically emailed out. Unfortunately, there is no way for me to make adjustments to the HTML formatting before the final email dispatch.
To work around this limitation, I have devised a method to introduce certain properties into the table by injecting custom child elements through the SQL query itself. For instance:
Original query: SELECT column1 FROM table;
Resulting HTML cell output:
<td>
<p>
<span> value </span>
</p>
</td>
Modified query:
SELECT '<span style="color:red">' + column1 + '</span>' AS [column1] FROM table;
Resulting HTML cell output:
<td>
<p>
<span>
<span style="color:red"> value </span>
</span>
</p>
</td>
While this technique allows me to tweak text styles, the roadblock lies in figuring out how to manipulate the background-color property of the parent <td>
element using these means. Is there a potential workaround for changing the style attributes of the <td>
element within this framework? Or am I facing a dead-end in terms of customization?