Font Awesome 5 font-family issue

前端 未结 16 2768
深忆病人
深忆病人 2020-12-12 14:31

I integrated Font Awesome 5 in a project with bootstrap 4. When I recall a font via CSS it does not work. with Font Awesome 4 the code was as follows:

#mainN         


        
16条回答
  •  执念已碎
    2020-12-12 14:57

    Strangely you have to include the font-family and the font-weight for it to work. Here is what worked for me:

    .second-section-header::after {
        content: "\f259";
        font-family: 'Font Awesome\ 5 Free';
        font-weight: 900;
    }
    

    From there, you can begin adding any styles that you want.

    Let's say:

    .second-section-header::after {
        content: "\f259";
        font-family: 'Font Awesome\ 5 Free';
        font-weight: 900;
        font-size: 100px;
        color: white;
        z-index: 1;
        position: absolute;
    }
    

    I hope this helps.

提交回复
热议问题