Skip to content
Related Articles

Related Articles

CSS | font-family Property
  • Last Updated : 08 Aug, 2019

The font-family property specifies the font of an element. It can have multiple fonts as a backup system i.e. if the browser doesn’t support one font then the other can be used.

Syntax:

element_selector {
    font-family: fonts-name|initial|inherit;
} 

Property values:

  • fonts-name: The names of the font in quotes separated by commas.
  • initial: Sets the property to its default value.
  • inherit: Inherits the property from the parent element.

Example:




<!DOCTYPE html>
<html>
    <head>
        <title>
            CSS | font-family Property
        </title>
        <style>
            .para1 {
                font-family: "Impact", Times, serif;
             }
  
            .para2 {
                font-family: Arial, Helvetica, sans-serif;
            }
        </style>
</head>
<body>
    <h1>Font-family Property</h1>
    <p class="para1">GeeksforGeeks in Impact font</p>
    <p class="para2">GeeksforGeeks in Arial font.</p>
</body>
</html>    

Output:

Supported Browsers: The browsers supported by font-family property are listed below:

  • Google Chrome 1.0
  • Internet Explorer 4.0
  • Firefox 1.0
  • Opera 3.5
  • Apple Safari 1.0
My Personal Notes arrow_drop_up
Recommended Articles
Page :