简体   繁体   English

在 JS 脚本中为 font-awesome 添加颜色

[英]Adding color to font-awesome in JS script

Have found a JS code that show a icon from font-awesome, but its white and i'm trying to add a color to it, but can't find the right class to add it on in CSS file.找到了一个 JS 代码,它显示了一个来自 font-awesome 的图标,但它是白色的,我正在尝试为其添加颜色,但找不到正确的类将其添加到 CSS 文件中。

The JS codeblock is: JS代码块是:

      // Transportation icon
  var cellTransport = document.createElement("td");
  cellTransport.className = "timeinfo";
  var symbolTransportation = document.createElement("span");
  symbolTransportation.className = this.config.iconTable[currentDeparture.transportation];
  cellTransport.appendChild(symbolTransportation);

How can I add a color to "symbolTranspotation" ?如何为“symbolTranspotation”添加颜色?

尝试将其添加到样式

symbolTransportation.style.color = "lightblue"

您可以使用属性style来添加颜色。

symbolTransportation.style.color = 'red';

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

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