Visit Mozilla.org

CSS:font-weight

From MDC

« CSS Reference

[edit] Summary

The font-weight property specifies the weight or boldness of the font.

[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

View Live 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