这个问题在这里已有答案:
我正在尝试将样式应用于特定元素,即。值为Priority 1的元素应为红色,优先级3应为绿色
有没有办法在css中应用条件样式?我无法更改html或更改它。
这是css代码:
.priorityDerived_shortCodeCell{
background: none repeat scroll 0 0 #EC1818 !important;
}
提前致谢
通常你可以使用这个:
<style>.red { color: red; }</style>
<table>
<tr>
<td>PRIORITY1</td>
<td>PRIORITY2</td>
<td>PRIORITY3</td>
<td>PRIORITY1</td>
</tr>
</table>
<script>$('td:contains("PRIORITY1")').addClass("red");</script>
由于您无法控制HTML文件或服务例程,因此极少数解决方案之一就是将插件编程到Chrome并让Chrome为这些行添加颜色:-)