font-sizeNN 4   IE 4   CSS 1
 Inherited: Yes
 

Determines the font size of the element. The font size can be set in several ways. A collection of constants (xx-small, x-small, small, medium, large, x-large, xx-large) defines what are known as absolute sizes. In truth, these are absolute as far as a single browser in a single operating system goes because the reference point for these sizes varies with browser and operating system. But they do let the author have confidence that one element set to large is rendered larger than another set to medium.

Another collection of constants (larger, smaller) are known as relative sizes. Because the font-size attribute is inherited from the parent element, these relative sizes are applied to the parent element to determine the font size of the current element. It is up to the browser to determine exactly how much larger or smaller the font size is, and a lot depends on how the parent element's font size is set. If it is set with one of the absolute sizes (large, for example), a child's font size of larger means that the font is rendered in the browser's x-large size. The increments are not as clear cut when the parent font size is set with a length or percentage.

If you elect to use a length value for the font-size attribute, choose a unit that makes the most sense for fonts, such as points (pt) or ems (em). The latter bases its calculation on the size of the parent element's font size. Finally, you can set the font-size to a percentage, which is calculated based on the size of the parent element's font size.

 
CSS Syntax
font-size: absoluteSize | relativeSize | length | percentage
 
JavaScript Equivalent
fontSize
 
Value
For an absolute size, one of the following constants: xx-small | x-small | small | medium | large | x-large | xx-large. For a relative size, one of the following constants: larger | smaller.
 
Initial Value
medium (for BODY element); the parent element's font-size value (for all others).
 
Example
BODY {font-size: 14pt}
P.teeny {font-size: x-small}
EM {font-size: larger}
SPAN.larger {font-size: 150%}
 
Applies To
All elements.
 
Object Model Reference
IE [window.]document.all.elementID.style.fontSize
Hosted by uCoz