根据标题,我想知道如何用不同的button
状态更改Font Awesome图标颜色。
例如,我有如下自定义的search
和clear
按钮。
我也在使用Bootstrap,类名btn
来自bootstrap。
<button class="btn search">Search</button>
<button class="btn clear">Clear</button>
我已经将图标嵌入到带有psuedo类的
search
按钮中.search:before {
font-family: 'FontAwesome';
content: "\f002";
margin-right: 5px;
color: darkorange;
}
当
按钮打开。
有没有办法用css来做呢?
这是JS Fiddle。
最佳答案
我相信你要找的是:active
而不是:focus
。
.search:active:before, .clear:active:before {
color: white;
}
看看下面的fiddle。
关于html - CSS(Font Awesome)-在没有Javascript的情况下更改不同按钮状态的图标颜色,我们在Stack Overflow上找到一个类似的问题:https://stackoverflow.com/questions/19353220/