Open In App

HTML <font> Tag

Last Updated : 26 Dec, 2023
Improve
Improve
Like Article
Like
Save
Share
Report

The HTML <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 and it was used in HTML4. The base font tag is used to set all the text to the same size, color, and face.

Note: Font tag is not supported in HTML5. 

Syntax:

<font attribute = "value"> Content </font>

In HTML 5 we use as:

<p style="color:green">GeeksforGeeks is a leading platform</p>

Attributes:

Example: In this example, we have used the <font> tag with a font size of 5.

HTML




<!DOCTYPE html>
<html>
  
<body>
    <h2>GeeksforGeeks</h2>
    
    <!--Normal paragraph tag-->
    
    <p>Hello Geeks!.</p>
    
    <!--font tag-->
    
    <font size="5"> Welcome to GeeksforGeeks </font>
</body>
  
</html>


Output:

HTML tag

Font Size

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

Syntax:

<font size="number">

Example: This example uses the <font> tag where different font sizes are specified.

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 size attribute

Font Type

The 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.

Syntax:

<font face="font_family">

Example: This example describes the <font> tag with different font type & font size.

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 type attribute

Font Color

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

Syntax:

<font color="color_name|hex_number|rgb_number">

Example: This example describes the <font> tag with different font colors.

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:

font color attribute

Supported Browsers:

  • Google Chrome 1
  • Edge 12 and above
  • Firefox 1 and above
  • Opera 15 and above
  • Safari 4 and above


Like Article
Suggest improvement
Previous
Next
Share your thoughts in the comments

Similar Reads