Please note, this is a STATIC archive of website developer.mozilla.org from November 2016, cach3.com does not collect or store any user information, there is no "phishing" involved.

UWAGA: Tłumaczenie tej strony nie zostało zakończone.
Może być ona niekompletna lub wymagać korekty.
Chcesz pomóc? | Dokończ tłumaczenie | Sprawdź ortografię | Więcej takich stron+.

Podsumowanie

Własność font-size określa rozmiar czcionki. Może ona również zmienić wielkość innych elementów, od momentu gdy zostanie użyta do obliczenia wartości em i ex jednostek długości.

Składnia

font-size: xx-small | x-small | small | medium | large | x-large | xx-large

font-size: smaller | larger

font-size: <length> | <percentage> | inherit

Wartości

xx-small, x-small, small, medium, large, x-large, xx-large 
A set of absolute size keywords based on the user's default font size (which is medium). Similar to presentational HTML's <font size="1"> through <font size="7"> where the user's default font size is <font size="3">.
larger, smaller 
Larger or smaller than the parent element's font size, by roughly the ratio used to separate the absolute size keywords above.
<length>
A positive length.
<percentage> 
A positive percentage of the parent element's font size.

It is best to avoid using values that are not relative to the user's default font size, such as <lengths> with units other than em or ex. However, if such values must be used, px are preferred over other units because their meaning does not vary depending on what the operating system thinks (generally incorrectly) the resolution of the monitor is.

Przykłady

Zobacz przykład

/* Set paragraph text to be very large. */
p { font-size: xx-large }

/* Set h1 (level 1 heading) text to be 2.5 times the size
 * of the text around it. */
h1 { font-size: 250% }

/* Sets text enclosed within span tag to be 16px */
span { font-size: 16px; }

Notes

em and ex units on the font-size property are relative to the parent element's font size (unlike all other properties, where they're relative to the font size on the element). This means em units and percentages do the same thing for font-size.

Specifications

Browser compatibility

See also

font

 

 

Autorzy i etykiety dokumentu

 Autorzy tej strony: teoli, splewako, Acrobot, Witia, Mgjbot, Killerowski
 Ostatnia aktualizacja: teoli,