This property controls the size of text for a section. Objects within
a section (such as Applets, Images and Horizontal Rules) are not
affected by this property. The actual size of the font can be different
than the value specified for 'font-size' due to interactions with the
'font-size-adjust' property. Child elements inherit the calculated value
of the 'font-size' property.
Allowed Values
inherit
[CSS2] [N6|O7]
Type: Explicit
Description:
Explicitly sets the value of this property to that of the parent.
xx-small | x-small |
small | medium |
large | x-large |
xx-large
[CSS1|CSS2]
[IE3B1|N4B3|O3.5]
Type: Explicit
Description:
These values are computed against a table of available font sizes compiled by
the browser. Medium is the default value for the 'font-size' property and
should be equivalent to the current browser default size. A scaling factor
of 1.2 is suggested in CSS2 for adjacent keyword values.
smaller | larger
[CSS1|CSS2]
[IE4B1|N4B3|O3.5]
Type: Calculated
Description:
This size change value is relative to the font size of the parent element
but is limited in range to that allowed by the system.
[length]
[CSS1|CSS2]
[IE3B1|N4B2|O3.5]
Type: Explicit
Description:
Refers to either the length in relation to the current element or an
absolute measurement. Negative values are not allowed.
[percentage]
[CSS1|CSS2]
[IE3B1|N4B3|O3.5]
Type: Explicit
Description:
Refers to a percentage of the font size of the parent element.
Example
Ext/Doc: h5.xsmall
{ font-size: x-small }
In-Line: <h5STYLE="font-size:
x-small">text</h5>
Notes
In CSS1 the suggested font scaling factor between explicit keyword
indices was 1.5. Practice proved this value to be too large, so the
recommendation was changed to a scaling factor of 1.2.
For this property in CSS2, the 'em' and 'ex' measurements refer to the
font size of the parent element.
Browser Peculiarities
All
- The "inherit" value is listed in the standards for this property, although
the property is itself inherited. This means it is impossible to check
to see if this value is actually supported in any browser. Mozilla began
generally supporting "inherit" where appropriate in version 6.x, and
Opera beginning mostly in 7.x. IE does not yet support "inherit" anywhere
yet. So, for all inherited properties, support information for the
"inherit" value will be listed as beginning in these respective versions.
Internet Explorer
3.0:
- Keyword values of "smaller"/"larger" both treated as "small"
- Negative values for length measurements are converted to
positive values, not ignored as they should be.
- Percentages are based on the default font-size for an element,
not the font-size of the parent.
4.0+:
- Default font-size is now "small", not "medium".
Netscape
4.0:
- Default font-size is "small", not "medium" as expected.
- Using the keyword "smaller" from the default font size ("small")
sets the size to "xx-small", not "x-small" as expected.
- Using the keyword "larger" from the default font size ("small")
sets the size to an almost-"large" size, but not exactly the same.
- Percentages under 100% quickly make the text content unreadable
(as well as changing the color of the text.)
- 100% is not the same as the default font size.
- Percentages are based on the default font-size, not the
font-size of the parent.
- If you use the 'font' property, you MUST specify
BOTH the 'font-size' and 'font-family' sub-components
of this property or else the style declaration will be ignored -
even if you have also set the 'font-size' and 'font-family'
properties individually for the same selector! Specifying both
of these sub-properties for 'font' is actually required under
the specifications, but Netscape is the only browser that
requires it. IE and Opera are fine if you only use one of these.
Opera
3.5:
- Using the keyword "smaller" from the default font size ("medium")
sets the size to "x-small", not "small" as expected.