当前位置: 动力学知识库 > 问答 > 编程问答 >

css - Cannot change background-color of tr element in Chrome DevTools Styles panel

问题描述:

I have the following HTML:

...

<tr role="row" class="odd">

<td width="70" ...

<td class=" customHoverEnabled" ...

<td ...

<td class="text-right" ...

<td class="last-child text-right" ...

</tr>

...

I have not been able to change the background-color attribute of the tr tag using the Styles panel in Chrome (canary) DevTools, like so:

What befuddles me is this: Doesn't element.style have the final say in what style is applied to an element? Shouldn't it be able to override anything applied earlier?

When I style element.style for the inner td elements, it works, and the background color changes.

How can I go about understanding this problem? Is there a workaround?

网友答案:

Do your td elements have a background-color defined? Because the tr wraps around these, if they do you wouldn't necessarily see the tr background. Try setting the style on td elements to background-color: transparent; If that's not it could you provide a code snippet example?

分享给朋友:
您可能感兴趣的文章:
随机阅读: