Summary -

In this topic, we described about the below sections -

Fonts play very important in a HTML page designing. Fonts color and face depends on computer and browser it used to display the HTML Page. <font> and <basefont> tags are used for the HTML tags design.

<font> tag is style, size and color to the text to HTML page. Lets discuss about the tags in detail.

<font> Tag:

The <font> tag is not supported in HTML5. Text family, size and color will be specified. The <font> tag is supported in Internet Explorer 9, and earlier versions.

<font> tag use in head section as well as body section. The <font> tag is having three attributes called size, color, and face to customize fonts. To change any of the font attributes at any time using the <font> tag.

The text that follows the <font> tag will remain unchanged until </font> tag.

Syntax -

<font>.. text here.. </font>

Optional Attributes -

AttributeDescriptionValues
ColorSpecifies the color of the textColor_name RGB(x,x,x) #RRGGBB
FaceSpecifies the text fontFont_family
SizeSpecifies the font sizeThe range of accepted values is from 1(smallest) to 7(largest). The default size of a font is 3.number

Example -

<!DOCTYPE html>
<html>
<head>
	<title>Font tag example.. </title>
</head>
<body>
	<font face="verdana" color="green" size="1">Font example output
	 display for color green and of size=1</font> <br>
	<font face="verdana" color="red" size="2">Font example output
	 display for color red and of size=2</font> <br>
	<font face="verdana" color="yellow" size="3">Font example output
	 display for color yellow and of size=3</font> <br>
	<font face="verdana" color="blue" size="4">Font example output
	 display for color blue and of size=4</font> <br>
</body>
</html>

Output -

Font example output display for color green and of size=1
Font example output display for color red and of size=2
Font example output display for color yellow and of size=3
Font example output display for color blue and of size=4

<basefont> Tag

The <basefont> tag is not supported in HTML5. Text family, size and color will be specified. The <basefont> tag is supported in Internet Explorer 9, and earlier versions. <basefont> tag use in head section as well as body section.

The <basefont> tag is having three attributes called size, color, and face to customize fonts. To change any of the font attributes at any time using the <basefont> tag. The text that follows the <basefont> tag will remain unchanged until </basefont> tag.

Syntax -

<basefont>.. text here.. </basefont>

Optional Attributes -

AttributeDescriptionValues
ColorSpecifies the color of the textColor_name RGB(x,x,x) #RRGGBB
FaceSpecifies the text fontFont_family
SizeSpecifies the font sizeThe range of accepted values is from 1(smallest) to 7(largest). The default size of a font is 3.number

Example -

<!DOCTYPE html>
<html>
<head>
	<title>Basefont tag example.. </title>
</head>
<body>
	<basefont face="verdana" color="green" size="1">Font example output 
	display for color green and of size=1</basefont> 
	
	<p>basefont tag is not supported in any browser. Use CSS instead.</p>
</body>
</html>

Output -

Font example output display for color green and of size=1

Note! Use CSS instead as <basefont> tag is not supported in any browser.