What CSS property is used to change the font face?


We can use the font-family property for achieving this. The font-family property is used for specifying what font needs to be applied on the targetted DOM element. It can hold several font names as part of the “fallback” mechanism in case the browser does not support the fonts. For example, we can use:

p {
  font-family: "Times New Roman", Times, serif;
}

In the above piece of code, we are applying font-family property to the paragraph element.

If you do not want the font-face of the paragraph element to be Times New Roman/Times/serif font, and you want to use the Arial/Helvetica/sans-serif font, then we can just update the CSS property of the paragraph element as:

p {
  font-family: Arial, Helvetica, sans-serif;
}

 



Article ID: 1067
Created: Fri, Jun 3, 2022
Last Updated: Fri, Jun 3, 2022
Author: Administrator

Online URL: https://www.articlediary.com/article/what-css-property-is-used-to-change-the-font-face-1067.html