CSS | font-family Property

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:

filter_none

edit
close

play_arrow

link
brightness_4
code

<!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>    

chevron_right


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

Appsecco | Web developer | IEEE | GeeksforGeeks Intern | Aspiring Cyber Security Specialist | Camcann Visit https//ashwingoelcom

If you like GeeksforGeeks and would like to contribute, you can also write an article using contribute.geeksforgeeks.org or mail your article to contribute@geeksforgeeks.org. See your article appearing on the GeeksforGeeks main page and help other Geeks.

Please Improve this article if you find anything incorrect by clicking on the "Improve Article" button below.




Article Tags :

Be the First to upvote.


Please write to us at contribute@geeksforgeeks.org to report any issue with the above content.