CSE 154 Examples

Font Family Property

The Font Family property is used to specify the font of the text the style is applied to.

Description

The font-family property can take in multiple font names. If one of the fonts in the property isn't available, the other fonts are tried until one of the fallback fonts can be used. multiple fonts can easily be stated in the same line just separated by a comma.

Note that if a font name has multiple words, the font name should be surrounded by quotes.

Syntax :

                  
                      element {
                        font-family: font-family_1, font-family_2;
                      }

                      p {
                        background-color: "Times New Roman", Arial, Helvetica;
                      }
                  
                

HTML :

CSS :

Live Preview :