Font awesome 5 on pseudo elements

前端 未结 8 2033
面向向阳花
面向向阳花 2020-12-07 12:22

In font awesome 4 you could easily apply an icon to a :before/:after element using CSS.

Is the same possible with the new font awesome 5 JS/SVG implementation? As fr

8条回答
  •  执笔经年
    2020-12-07 13:18

    Use this Link ->: https://use.fontawesome.com/releases/v5.5.0/css/all.css

    CSS
    
    ul li{
        list-style-type: none;
        position: relative;
    }
    
    ul li:before{
      position: absolute;
      color:#ff0000;
      top:0;
      left:-30px;
      font-family: 'Font Awesome 5 Free';
      font-size:1.2em;
      content: "\f105";
      font-weight: 900; /* <-- add this or 400 for other styles */
      display: inline-block;
      font-style: normal;
      font-variant: normal;
      text-rendering: auto;
      -webkit-font-smoothing: antialiased;
    }
    

提交回复
热议问题