asp.net.ph

Skip Navigation Links

font-weight Attribute | fontWeight Property

CSS Attributes Index   Font Attributes


Sets or retrieves the boldness of the object’s text.

Syntax


CSS { font-weight: 'normal' | 'bold' | 'bolder' | 'lighter' | '100' | '200' | '300' | '400' | '500' | '600' | '700' | '800' | '900' }
Script object.style.fontWeight = sWeight ]

Possible Values


normal The font is normal.
bold The font is bold.
bolder The font is heavier than normal bold.
lighter The font is lighter than normal.
100 The font is at least as light as the 200 weight.
200 The font is at least as bold as the 100 weight and at least as light as the 300 weight.
300 The font is at least as bold as the 200 weight and at least as light as the 400 weight.
400 The font is normal.
500 The font is at least as bold as the 400 weight and at least as light as the 600 weight.
600 The font is at least as bold as the 500 weight and at least as light as the 700 weight.
700 The font is bold.
800 The font is at least as bold as the 700 weight and at least as light as the 900 weight.
900 The font is at least as bold as the 800 weight.

The property is read/write with a default value of normal; the cascading stylesheet ( CSS ) attribute is inherited.

Remarks

The key words for font-weight values are mapped to specific font variations depending on the fonts that are installed on the user's computer. In many cases, the user will not see the difference between different font-weight settings because the system will choose the closest match.

Setting the font-weight to 400 is equivalent to normal, and 700 is equivalent to bold. A font-weight of bolder or lighter is interpreted relative to the parent object’s weight. A value of bolder for text whose parent is normal would set the text to bold.

Microsoft® Internet Explorer® 4.0 supports only normal and bold.

Microsoft® Internet Explorer® 3.0 supports the font-weight attribute through the font, @font-face Rule, font-family, font-size, font-style, font-variant, font-weight attribute.

Example

The following example demonstrates the effects of applying the different values possible for the CSS font-weight attribute.

<ul>
   <li style="font-weight:normal">Normal
   <li style="font-weight:bold">Bold
   <li style="font-weight:bolder">Bolder
   ...
</ul>

 Show me 

The sample below uses inline event handlers to dynamically set an object’s fontWeight property in response to mouse events.

<p onmouseover="this.style.fontWeight='bolder'"
   onmouseout="this.style.fontWeight=''">
   ...
</p>

 Show me 

See Also

font, @font-face Rule, font-family, font-size, font-style, font-variant



© 2025 Reynald Nuñez and asp.net.ph. All rights reserved.

If you have any question, comment or suggestion
about this site, please send us a note