• Add the below line at the beginning of style.css.
    sudo gvim /var/www/html/wp/wp-content/themes/twentyfourteen/style.css
    *{font-family: Bitstream Vera Sans!important;}

    I found that the font-family is still not Bitstream Vera Sans.

    View post on imgur.com


    https://imgur.com/gallery/XgcBsbv

    1.*{font-family: Bitstream Vera Sans!important;} is gone.
    2.no file style.css?v=4.9.8

    Why can’t set font-family as expected?

    • This topic was modified 6 years, 2 months ago by elearn2014.
    • This topic was modified 6 years, 2 months ago by elearn2014.
    • This topic was modified 6 years, 2 months ago by elearn2014.
Viewing 2 replies - 1 through 2 (of 2 total)
  • Hi @elearn2014,

    So, you opened the var/www/html/wp/wp-content/themes/twentyfourteen/style.css file and added

    *{font-family: Bitstream Vera Sans!important;}
    

    at the end of the file to apply this Bitstream Bera Sans font to all of the elements from your website? If yes, can you tell me if you included the font files too?

    Also, here’s an article that you can follow in order to add a new font to your website the right way: https://www.wpbeginner.com/wp-themes/how-to-add-custom-fonts-in-wordpress/

    In addition to what Radu said,
    1. The theme is most likely loading a minified version, not the unminified version.
    2. Styles cascade, so putting it at the beginning is not the best.
    3. It’s !important not ! important.
    4. Font names with spaces need quotes.
    5. Font family should always have a fallback font.

    But yeah, the most important thing is that the font isn’t loaded.

Viewing 2 replies - 1 through 2 (of 2 total)
  • The topic ‘Why can’t set font-family as expected?’ is closed to new replies.