csswordpressfont-face

Multiple font-face declarations, does !important make a difference?


I have a Wordpress website, but I'm not a specialist on Wordpress. I noticed my theme had an issue with its fonts, they weren't loaded because the font-display property had fallback as value (and the server sucks and doesn't load things in time...). So I went to the default CSS file for Wordpress and added the font-faces again, this time with font-display: swap !important.

I have 2 questions:

  1. Can one use !important for font-display?
  2. If one sets !important for font-display, will it make any difference? What if there is more than one CSS file specifying font-faces, but only one with the !important flag? Will it execute the !important declaration or just the last declaration of the last file?

Solution

  • font-display is a descriptor, not a property. !important is invalid on descriptors and its effect will be to make the descriptor not work at all.

    See Defining Grammars for Rules and Other Values