Search code examples
cssspiceworks

How can I change a table td width using CSS in Spiceworks?


I’m trying to make a small change on a CSS for Spiceworks.

This is the line that I want to change:

<td class="body-id cell-id" style="width: 12%; "></td>

Now this code:

SPICEWORKS.utils.addStyle('body{background-color:blue}');

changes the bg color to whatever I want. I think I can also use the SPICEWORKS.utils.addStyle to change a width of a table. What I don’t know is how can I say to the program that I want to change that specific <td>’s width?

P.S. I’m just a trainee so I’m not a pro in programming.


Solution

  • According to Spicework’s documentation, addStyle adds a CSS block to the <head> of the HTML page.

    Because your <td> has its width defined in its style attribute, that width will actually override whatever you add via addStyle, unless (I think) you add !important to the style you add.

    Could you try this?

    SPICEWORKS.utils.addStyle('td.body-id.cell-id{width:100px !important;}');