CSS font-weight property

CSS font-weight property

Description

The font-weight property changes the visual weight of characters within an element.

Possible Values

  • 100, 200, 300, 400, 500, 600, 700, 800, and 900 − Defines the weight of characters from light to heavy. 400 is the same as normal, and 700 is the same as bold.
  • normal − The default value. This represents a normal character, equivalent to a value of 400.


  • bold − Equivalent to a value of 700.

  • bolder − The element’s font weight should be heavier than the parent element’s font weight.

  • lighter − The element’s font weight should be lighter than the parent element’s font weight.

Applies to

All HTML elements.

DOM Syntax

object.style.fontWeight = "900"; 

Example

Here is an example of using this property:

<html> 
<head> 
</head> 

<body> 
<p style = "font-weight:bold;"> 
This font is bold. 
</p> 

<p style = "font-weight:bolder;"> 
This font is bolder. 
</p> 

<p style = "font-weight:500;"> 
This font is 500 weight. 
</p> 
</body> 
</html> 

The following is the result produced:

CSS font-weight property

Leave a Reply

Your email address will not be published. Required fields are marked *