質問

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