HTML <font> tag
The <font> tag is used to define the font style in an HTML document. Font style includes font face, size and color.
It is obsolete in HTML5 and completely replaced by CSS properties.
Type: Inline Element
Syntax of <font> tag
<font color="color-name" size="font-size" face="font-family"> Text </font>
Supported Browsers
| Tag | Chrome | Internet Explorer | Firefox | Safari | Opera Mini |
|---|---|---|---|---|---|
| <font> | Yes | Yes | Yes | Yes | Yes |
Full code example
<!DOCTYPE html> <html> <head> </head> <body> <font color="red"> Red text. </font> <br> <font face="Arial"> Arial font. </font> <br> <font size="3"> 3-size text. </font> </body> </html>
Output on the browser
Red text.
Arial font.
3-size text.
Arial font.
3-size text.
Attributes of <font> tag
| Attribute | Value | Note |
|---|---|---|
| color | colorname rgb(value,value,value) #xxxxxx |
It defines the color of the text. |
| face | font-family | It defines the font-family of the texts. |
| size | number | It defines the size of the texts. |
Note: All the above attributes are not supported in HTML5 when they are using with <font> element without CSS.
More reference
Each of the attribute can be used for a single word only.Code:
<p> <font color="red">Red</font> <font face="Arial">Arial</font> <font size="5">Text</font> </p>
Red Arial Text
The above code can be replaced by CSS properties which allows styling with more flexibility.
<p> <span style="color:red;">Red</span> <span style="font-family:Arial;">Arial</span> <span style="font-size:20px;">Text</span> </p>
