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.

有帮助吗?

解决方案

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;}');

其他提示

You can use height/width property to change respective attributes of table/th/td etc.

. Check w3schools for more info

许可以下: CC-BY-SA归因
不隶属于 StackOverflow
scroll top