문제

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