CSS:font-weight
From MDC
[edit] Summary
The font-weight property specifies the weight or boldness of the font.
- Initial value:
normal - Applies to: all elements
- Inherited: yes
- Percentages: N/A
- Media:
visual - Computed value: One of the numeric values (100, etc.), or one of the numeric values plus one of the relative values (bolder or lighter)
[edit] Syntax
font-weight: normal | bold | bolder | lighter | 100 | 200 | 300 | 400 | 500 | 600 | 700 | 800 | 900 | inherit
[edit] Values
- normal
- Normal font weight. Same as 400.
- bold
- Bold font weight. Same as 700.
- lighter
- One font weight lighter than the parent element (among the available weights of the font).
- bolder
- One font weight darker than the parent element (among the available weights of the font).
- 100, 200, 300, 400, 500, 600, 700, 800, 900
- Numeric font weights for fonts that provide more than just normal and bold. If the exact weight given is unavailable, then 600-900 use the closest available darker weight (or, if there is none, the closest available lighter weight), and 100-500 use the closest available lighter weight (or, if there is none, the closest available darker weight). This means that for fonts that provide only normal and bold, 100-500 are normal and 600-900 are bold.
[edit] Examples
/* Set paragraph text to be bold. */
p {font-weight: bold}
/* Set h1 (level 1 heading) text to one step darker than
normal but less than a standard bold. */
h1 {font-weight: 500}
/* Sets text enclosed within span tag to be one step lighter
than the parent. */
span {font-weight: lighter}
[edit] Notes
[edit] Specifications
[edit] Browser compatibility
| Browser | Lowest Version |
|---|---|
| Internet Explorer | 3 |
| Netscape | 4 |
| Opera | 3.5 |
[edit] See also
font,
font-family,
font-size,
font-size-adjust,
font-stretch,
font-style,
font-variant,
font-weight,
@font-face