我使用table
生成ng-repeat
。
当用户选择一个表格行时,我可以申请突出显示table
行并应用特定的类。
问题是我在row
更改图标时遇到问题,突出显示的行background-color
为blue
,文字更改为white
,但图标仍然存在蓝色。
CSS
.selected{
background-color:#004b89;
color:white;
font-weight:bold;
}
HTML
<tr ng-repeat="item in vm.items ng-class="{'selected':$index == vm.selectedRow}" class="table-striped" ng-click="vm.setClickedRow($index)">
<td><a tooltip-placement="top"><i class="fa fa-pencil fa-2x link-icon"></i> </a>
<td><a tooltip-placement="top"><i class="fa fa-trash fa-2x link-icon"></i></a>
</tr>
答案 0 :(得分:8)
选择要更改颜色的font-awesome
类,因为可能是CSS特异性问题。
.not-selected .fa-pencil {
color: red
}
.not-selected .fa-trash {
color: green
}
.selected {
background-color: #004b89;
color: white;
font-weight: bold;
}
<link href="https://maxcdn.bootstrapcdn.com/font-awesome/4.6.3/css/font-awesome.min.css" rel="stylesheet" />
<table>
<tr class="not-selected">
<td><a tooltip-placement="top"><i class="fa fa-pencil fa-2x link-icon"></i></a>
<td><a tooltip-placement="top"><i class="fa fa-trash fa-2x link-icon"></i></a>
</tr>
<tr class="selected">
<td><a tooltip-placement="top"><i class="fa fa-pencil fa-2x link-icon"></i></a>
<td><a tooltip-placement="top"><i class="fa fa-trash fa-2x link-icon"></i></a>
</tr>
</table>
答案 1 :(得分:0)
.fa
{
color:black;
animation: colorchange1 50s;
-webkit-animation: colorchange1 50s
}
@keyframes colorchange1
{
0% {color: green;}
15% {color: orange;}
30% {color:purple;}
45% {color: #e74c3c;}
60% {color: violet;}
75% {color: indigo;}
90% {color: blue;}
100% {color: black;}
}
@-webkit-keyframes colorchange1 /* Safari and Chrome - necessary duplicate */
{
0% {color: green;}
15% {color: orange;}
30% {color:purple;}
45% {color: #e74c3c;}
60% {color: violet;}
75% {color: indigo;}
90% {color: blue;}
100% {color: black;}
}
希望它可以理解。