Skip to content
Related Articles

Related Articles

Improve Article

HTML <font> Tag

  • Difficulty Level : Basic
  • Last Updated : 07 Jun, 2021

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: 
 

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: 
 

HTML




<!DOCTYPE html>
 
<html>
 
    <body>
        <!--HTML font size tag starts here-->
        <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>
        <!--HTML font size tag ends here-->
    </body>
 
</html>                   

Output: 
 



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

Example: 
 

HTML




<!DOCTYPE html>
 
<html>
 
    <body>
        <!--HTML font face tag starts here-->
        <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 />
        <!--HTML font face tag ends here-->
    </body>
 
</html>                   

Output: 
 

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

Example: 
 

HTML




<!DOCTYPE html>
 
<html>
 
    <body>
        <!--HTML font color tag starts here-->
        <font color = "#009900">GeeksforGeeks</font><br />
        <font color = "green">GeeksforGeeks</font>
        <!--HTML font color tag ends here-->
    </body>
 
</html>                   

Output: 
 

Note: Font tag is not supported in HTML5. 

Supported Browsers: 
 

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

 

Attention reader! Don’t stop learning now. Get hold of all the important Comcompetitivepetitve Programming concepts with the Web Design for Beginners | HTML  course.




My Personal Notes arrow_drop_up
Recommended Articles
Page :