HTML Font and Basefont (HTML Tutorial part 12)

১১/১৮/২০১১ ০৭:৫৯:০০ AM | | 0 comments »

The <font> tag is used to add style, size, and color to the text on your site. Use the size, color, and face attributes to customize your fonts. Use a <basefont> tag to set all of your text to the same size, face, and color.

The font and basefont tags are deprecated and should not be used. Instead, use css styles to manipulate your font. See our CSS Tutorial for more information.

Font Size

Set the size of your font with size. The range of accepted values is from 1(smallest) to 7(largest).The default size of a font is 3.

HTML Code:

<p>
<font size="5">Here is a size 5 font</font>
</p>

Font Size:

Here is a size 5 font.

Font Color

Set the color of your font with color.

HTML Code:

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

<font color="red">This text is red</font>

Font Color:

This text is hexcolor #990000
This text is red

Font Face

Choose a different font face using any font you have installed. Be aware that if the user viewing the page doesn't have the font installed, they will not be able to see it. Instead they will default to Times New Roman. An option is to choose a few that are similar in appearance.

HTML Code:

<p>
<font face="Bookman Old Style, Book Antiqua, Garamond">This paragraph
 has had its font...</font>
</p>

Font Face:

This paragraph has had its font formatted by the font tag!

Basefont - Set a Solid Base

With the basefont tag you will be able to set the default font for your web page. We highly recommend specifying a basefont if you plan on using any font with HTML. Below is the correct way to set your basefont.

HTML Code:

<html>
<body>

<basefont size="2" color="green">

<p>This paragraph has had its font...</p>
<p>This paragraph has had its font...</p>
<p>This paragraph has had its font...</p>

</basefont>

</body>
</html>

Base Font:

This paragraph has had its font formatted by the basefont tag!
This paragraph has had its font formatted by the basefont tag!
This paragraph has had its font formatted by the basefont tag!
However, the use of basefont is deprecated, which means it may not be supported sometime in the future. The perfectly correct way to change your sites basefont is to set it with CSS. Check out our CSS Tutorial for more information.

Attribute Review

Attributes:

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

Beautiful First Letter Style

Customize your fonts to achieve any of your desired looks.

HTML Code:

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

Beauty:

Customize your font to achieve a desired look.