这是一个列表,其中一个列表已禁用。如你们所知,禁用时字体颜色为灰色。我使用的是IE9,我想改变字体颜色。有谁知道如何更改禁用的字体颜色???
这是我的代码:
<table id="list" cellspacing="0" border="1" style="border-collapse: collapse;">
<tr disabled bgcolor =#EAEAEA style="color:#ea0000;">
<td>name</td>
<td>email</td>
</tr>
<tr class="nameMail" onclick='op()'>
<td id="a"> </td>
<td id="b"> </td>
</tr>
</table>
最佳答案
您的代码无效。
你会做这样的事情:
input[type="text"]:disabled
{
color:#ea0000;
}
此外,“禁用”选择器应该主要与表单元素和控件一起使用。
如果您愿意,可以使用 tds 中的按钮,如下所示:
<table id="list" cellspacing="0" border="1" style="border-collapse: collapse;">
<tr bgcolor="#EAEAEA" style="color:#ea0000;">
<td><button disabled>name</button></td>
<td><button disabled>email</button></td>
</tr>
<tr class="nameMail" onclick='op()'>
<td id="a"> </td>
<td id="b"> </td>
</tr>
</table>
您还需要像这样更新 css 以消除按钮边框。
button{
border:0;
color:#ea0000;
}
button:disabled
{
color:#000;
}
关于javascript - 更改禁用的字体颜色,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/13522187/