Font Tag
The HTMLĀ <font>Ā tag was used in HTML 4 to specify theĀ font face, font size, and color of text1. However, this tag isĀ not supported in HTML5123Ā and should be replaced by CSS styles13.
The syntax of theĀ <font>Ā tag is:
TheĀ <font>Ā tag has three attributes:
-
size: This attribute is used to adjust the size of the text in the HTML document. The range of size is from 1 to 7 and the default size is 32.
-
color: This attribute is used to set the color of the text. The value can be a color name, a hexadecimal value, or an RGB value23.
-
face: This attribute is used to set the typeface or font family of the text. The value should be a font name that is installed on the system23.
Here is an example of using theĀ <font>Ā tag with different attributes:
The output would look like this:
This is some text.
However, as mentioned earlier, theĀ <font>Ā tag is deprecated and should not be used in modern web pages. Instead, you can use CSS styles to achieve the same effect. For example, you can use the following CSS properties to style your text13:
-
color: This property sets the color of the text.
-
font-size: This property sets the size of the text.
-
font-family: This property sets the typeface or font family of the text.
Here is an example of using CSS styles to style your text:
The output would look like this:
This is some text.
You can learn more about CSS Text and CSS Fonts in our CSS tutorial1.