HTML - Font & basefont

  »   HTML  »   HTML Tutorial - Using Font And Basefont Tag

The <font> tag is used for modifying the type of a text, the size and the color. Use "size", "color" and "face" attributes to personalize your text and the <basefont> tag to set the color, size and the style of a whole text.

Mostly the "font" and "basefont" tags are not used much, because CSS offers a much better way to set text's attributes.

The font size

Set the size of your font. There are accepted values between 1 (the smallest) and 7(the biggest). The standard value of a text is 3.

html<p><font size="5">This is font size 5</font></p>

Demo

This is font size 5

The font color

Set the color of the text

html<p>
	<font color="#990000">This text is hexcolor #990000</font><br />
	<font color="red">This text is red</font>
</p>

Demo

This text is hexcolor #990000
This text is red

Font face

Pick a letter style using the font's face attribute. You can choose any font you have installed, but choose the font with care, because the user on your page can't see the font if he hasn't got installed your font. He will see the default font meaning Times New Roman. The solution would be to choose many fonts that look the same.

html<p><font face="Bookman Old Style, Book Antiqua, Garamond">This paragraph has had its font formatted  with the font's face atribute</font><p>

Demo

This paragraph has had its font formatted with the font's face atribute

Basefont

With the help of the "basefont" tag you can set the default value of the font on your web page. We recommend specifying a "basefont" in case you will use the font in HTML. Here you have an example.

html<html> 
	......
	<body>
		<basefont size="2" color="green">
		
			<p>This paragraph has had its font formatted with the basefont tag</p>
			<p>This paragraph has had its font formatted with the basefont tag</p>
			<p>This paragraph has had its font formatted with the basefont tag</p>
			
		</basefont>
	</body>
</html>

With all these, "basefont" is somehow deprecated. In the close future is possible that it won't work anymore and will be entirely replaced by CSS rules.

Attributes

Attribute="Value"Description
size="Num. Value 1-7"Size of your text, 7 is biggest
color="rgb,name,or hexadecimal"Change font color
face="name of font"Change the font type

The beginning "by the book"

html<p><font size="7" face="Georgia, Arial" color="maroon">C</font>ustomize your font to achieve a desired look.</p>

Demo

Customize your font to achieve a desired look.