简体   繁体   English

更改Bootstrap图标颜色

[英]Change Bootstrap icon color

I print this icon into a table using php code like this: 我使用php代码将此图标打印到表中,如下所示:

echo '<button Onclick="" style="border: none; background: none; color:green"><a title="Reenviar" data-toggle="tooltip"><i class="material-icons">&#xE0BE;</i></a></button>';

And I'd ike to change the icon's color. 我想更改图标的颜色。 I tried to add the color to the button style; 我试图将颜色添加到按钮样式中。 however it does not seem to work. 但是它似乎不起作用。

You should add style to i tag 您应该在i标签中添加样式

<i style = "color:blue;" class="material-icons">&#xE0BE;</i>

also, you can create a css class 另外,您可以创建一个CSS类

.blue {
    color:blue
}

and then just add that class to a tag 然后将该类添加到标签中

<i class="material-icons blue">&#xE0BE;</i>

You have to add the styling to the icon itself if you are using inline styling. 如果使用内联样式,则必须将样式添加到图标本身。

<i style="color: #ff0000" class="material-icons">&#xE0BE;</i>

Better yet you can use some some css to make this cleaner and more manageable and do something in css like this 更好的是,您可以使用一些css使其更清洁,更易于管理,并在css中执行类似的操作

.material-icons {
    color: #ff0000;
}

Checkout the css w3 schools code examples https://www.w3schools.com/css/ 签出CSS W3学校代码示例https://www.w3schools.com/css/

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM