HTML and CSS Reference
In-Depth Information
Element-Specific Attributes
color
This attribute sets the text color using either a browser-dependent named color or a
color specified in the hexadecimal
#RRGGBB
format.
face
This attribute contains a list of one or more font names separated by commas. The
user agent looks through the specified font names and renders the text in the first font that
is supported.
point-size
This Netscape 4-specific attribute specifies the point size of text and is used with
downloadable fonts. It is listed for historical purposes only and is easily mimicked using the
font-size
CSS property.
size
This attribute specifies the font size as either a numeric or relative value. Numeric
values range from
1
to
7
, with
1
being the smallest and
3
the default. The relative values,
+
and
-
, increment or decrement the font size relative to the current size. The value for
increment or decrement should range only from
+1
to
+6
or
-
1
to
-
6
.
weight
Under Netscape 4, this attribute specifies the weight of the font, with a value of
100
being lightest and
900
being heaviest. This is listed primarily for historical purposes; such
visual changes are best implemented using the
font-weight
CSS property.
Example
<p><font color="#FF0000" face="Helvetica, Times Roman" size="+1">
Relatively large red text in Helvetica or Times.
</font></p>
Compatibility
HTML 3.2, 4, 4.01 (transitional)
XHTML 1.0 (transitional)
Firefox 1+, Internet Explorer 2+,
Netscape 1.1+, Opera 4+, Safari 1+
Notes
• Use of this element is not encouraged, as it is not part of strict HTML and XHTML
specifications. HTML5 defines this element as obsolete. CSS properties like
font-face
,
color
, and
font-size
provide a richer way of providing the same
functionality as this element.
• Interestingly, the transitional specification for some reason does not define core
events for this element. In practice, they are supported by major browsers.
• The default text size for a document can be set using the
size
attribute of the
basefont
element.
• The HTML 3.2 specification supports only the
color
and
size
attributes for this
element.
• HTML5 appears to define all the common attributes for this element, but does not
define those which are important to perform its stated task.