<font>is a paired tag used to change the way text is displayed within <font> ... </font> tags. The effect is controlled by a number of attributes
The value of this attribute is a signed number, usually in the range -6 to +6. The current font size is changed. The units of font size measurement are arbitrary, all that can be said is that +6 is bigger than +5 etc. The font size can also be set to a particular value by omitting the sign.
Here are some examples.
this is +3 and this is -2
The HTML for the above is
<font size=+3> this is +3</font> and <font size=-2> this is -2</font>
The signed values change the font size by the indicated number of steps relative to its current value as set by both the <basefont> tag and the user setting of browser preferences. If the current value is large (e.g. a visually impaired user has set his browser preferences for a large font) then further increases may not have any noticeable visual effect.
Unisgned values set the font size to a particular value relative only to the user setting of browser preferences.
The colour of text can be changed. The value of the attribute is a colour coded in the usual way.
Here is an example
The HTML for the above is
<font color="#ff0000">ex</font><font color="#00ff00">am</font><font color="#0000ff">ple</font>
A few browsers allow the author to use this attribute to specify a particular typeface. This will, of course, only work if the browser understands this tag and can support the indicated typeface. It is not part of the HTML 3.2 standard.
This is in Times typeface and this is browser default.
Here's the HTML for the above
<font face="times">This is in Times typeface</font> and this is browser default
Note the face name is case insensitive.
Here are some examples that will be distinctive if your browser supports this facility and has the type faces available.
Face | Example |
---|---|
Browser Default | abcdefghijklmnopqrstuvwxyz |
Arial | abcdefghijklmnopqrstuvwxyz |
Verdana | abcdefghijklmnopqrstuvwxyz |
Times | abcdefghijklmnopqrstuvwxyz |
Helvetica | abcdefghijklmnopqrstuvwxyz |
Impact | abcdefghijklmnopqrstuvwxyz |
Zimqvist | abcdefghijklmnopqrstuvwxyz |
There is, of course, no such type face as Zimqvist. Most browsers will revert to the default type face in this case.
Some browsers may even allow a comma separated list of faces and use the first one in the list that is actually supported by the browser. This is actually quite useful. Netscape 3 understands Helvetica as a value for face but does not understand Arial whereas Microsoft Internet Explorer 3 understands Arial but not Helvetica so setting face="Helvetica, Arial" will give reasonably similar results with both browsers. The face attribute is not supported by Netscape 2.
<font> tags can be nested as is shown by this example
Hello
The HTML is<font size=+3>H<font color=red>e</font><font color=blue>l</font><font color=green>l</font>o</font>
This is all on one line because otherwise the new-lines would be seen as "white-space" by the browser and the word "Hello" would appear with spaces between the letters - this might be a desirable effect.
If the intermediate </font> tags were omitted the effect would be progressively deeper nesting and all text after the final 'o' would be in blue since the final </font> would only undo one level of nesting.
Browsers