如何更改字体真棒图标的颜色
How to change color of font awesome icons
我有一个 table
是使用 ng-repeat
生成的。
当用户选择 table 行时,我可以应用突出显示 table
行并应用特定的 class。
问题是我在更改图标时遇到问题 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>
select font-awesome
class 您想要更改颜色,因为可能是 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>
它的 easy.the 我在下面给出的代码是 l=有点酷而且颜色不断变化,就像 magic.Use 它和 c MAAGIC..
.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;}
}
希望可以理解。
我有一个 table
是使用 ng-repeat
生成的。
当用户选择 table 行时,我可以应用突出显示 table
行并应用特定的 class。
问题是我在更改图标时遇到问题 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>
select font-awesome
class 您想要更改颜色,因为可能是 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>
它的 easy.the 我在下面给出的代码是 l=有点酷而且颜色不断变化,就像 magic.Use 它和 c MAAGIC..
.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;}
}
希望可以理解。