HTML | <font> Tag

The <font> tag plays an important role in the web page to create an attractive and readable web page. The font tag is used to change the color, size, and style of a text. The base font tag is used to set all the text to the same size, color and face.

The font tag has basically three attributes which are given below:

  • Size
  • Face/Type
  • Color

font Size: This attribute is used to adjust the size of the text in the HTML document using font tag with size attribute. The range of size of the font in HTML is from 1 to 7 and the default size is 3.



Example:

filter_none

edit
close

play_arrow

link
brightness_4
code

<!DOCTYPE html>
<html>
    <head>
        <title>HTML font tag</title>
    </head>
      
    <body>
        <font size = "1">GeeksforGeeks!</font><br />
        <font size = "2">GeeksforGeeks!</font><br />
        <font size = "3">GeeksforGeeks!</font><br />
        <font size = "4">GeeksforGeeks!</font><br />
        <font size = "5">GeeksforGeeks!</font><br />
        <font size = "6">GeeksforGeeks!</font><br />
        <font size = "7">GeeksforGeeks!</font>
    </body>
</html>                    

chevron_right


Output:

GeeksforGeeks!! = "1"
GeeksforGeeks!! = "2"
GeeksforGeeks!! = "3"
GeeksforGeeks!! = "4"
GeeksforGeeks!! = "5"
GeeksforGeeks!! = "6"
GeeksforGeeks!! = "7"

Font Type: Font type can be set by using face attribute with font tag in HTML document. But the fonts used by the user needs to be installed in the system first.
Example:

filter_none

edit
close

play_arrow

link
brightness_4
code

<!DOCTYPE html>
<html>
    <head>
        <title>Example of Font Type</title>
    </head>
      
    <body>
        <font face = "Times New Roman" size = "6">
                             GeeksforGeeks!!</font><br />
        <font face = "Verdana" size = "6">
                             GeeksforGeeks!!</font><br />
        <font face = "Comic sans MS" size =" 6">
                             GeeksforGeeks!!</font><br />
        <font face = "WildWest" size = "6">
                             GeeksforGeeks!!</font><br />
        <font face = "Bedrock" size = "6">
                             GeeksforGeeks!!</font><br />
    </body>
</html>                    

chevron_right


Output:

 GeeksforGeeks!!
GeeksforGeeks!!
GeeksforGeeks!!
GeeksforGeeks!!
GeeksforGeeks!!

Font Color: Font color is used to set the text color using font tag with color attribute in HTML document. Color can be specify either with its name or with its hex code.
Example:

filter_none

edit
close

play_arrow

link
brightness_4
code

<!DOCTYPE html>
<html>
    <head>
        <title>Font Color</title>
        <style>
            body {
                font-size:40px;
                font-weight:bold;
                text-align:center;
            }
        </style>
    </head>
    <body>
        <font color = "#009900">GeeksforGeeks</font><br />
        <font color = "green">GeeksforGeeks</font>
    </body>
</html>                    

chevron_right


Output:
font-color

Note: Font tag is not supported in HTML5.
Supported Browser: The browser supported by <font> tag are listed below:

  • Google Chrome
  • Internet Explorer
  • Firefox
  • Opera
  • Safari


My Personal Notes arrow_drop_up

Check out this Author's contributed articles.

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 :
Practice Tags :


Be the First to upvote.


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