【问题标题】:Changing styles of Font icons更改字体图标的样式
【发布时间】:2021-12-31 05:31:54
【问题描述】:

我想改变宽度、高度并旋转正方形。我尝试使用内联样式提供样式,但它不起作用。我的代码如下:

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

 faSquare =faSquare;

html:

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

【问题讨论】:

    标签: angular8 angular9


    【解决方案1】:

    您可以在图标内部提供内联样式,如下所示:

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

    【讨论】:

      【解决方案2】:

      component.ts:
      import { faSquare } from '@fortawesome/free-solid-svg-icons';
      
       faSquare =faSquare;
      
      html:
      
      <fa-icon [icon]="faSquare"</fa-icon>

      【讨论】:

        【解决方案3】:
        component.ts:
        import { faSquare } from '@fortawesome/free-solid-svg-icons';
        
        faSquare =faSquare;
        
        html:
        
        <fa-icon [icon]="faSquare" [styles]="
        
        #change width, height
        {height: '64px', width: '64px', 
        
        #rotate square
        transform: 'rotate(30deg)'}">
        
        </fa-icon>
        

        【讨论】:

          猜你喜欢
          • 1970-01-01
          • 1970-01-01
          • 1970-01-01
          • 1970-01-01
          • 2011-12-02
          • 2011-09-15
          • 2013-12-06
          • 2015-02-19
          • 2015-03-13
          相关资源
          最近更新 更多