【问题标题】:Changing styles of fontawesome icons改变 fontawesome 图标的样式
【发布时间】:2021-12-31 00:50:27
【问题描述】:

我在我的 Angular 代码中使用了很棒的字体图标。我的代码如下:

component.ts:
import { faSquare } from '@fortawesome/free-solid-svg-icons';

 faSquare =faSquare;

html:

<fa-icon [icon]="faSquare"</fa-icon>

我想改变宽度、高度并将这个正方形旋转 45 度。我尝试使用内联样式提供样式,但它不起作用。该怎么做?

【问题讨论】:

    标签: angular angular8 angular9


    【解决方案1】:

    您可以为图标提供内联样式:

        <fa-icon [icon]="faSquare" [styles]="{height: '30px', width: '30px', transform: 'rotate(45deg)'}"></fa-icon>
    

    输出:

    您还可以参考Features 文档以了解更多信息。

    【讨论】:

      猜你喜欢
      • 2015-10-24
      • 1970-01-01
      • 2020-05-15
      • 1970-01-01
      • 2016-10-16
      • 2013-07-24
      • 2020-12-06
      • 2023-03-11
      • 2021-08-08
      相关资源
      最近更新 更多