CSS font-weight ιδιότητα

Definition and Usage

The fontWeight property sets the thickness of the text.

Description

This property is used to set the boldness of the text displayed by the element. The numeric value 400 is equivalent to the keyword normal, and 700 is equivalent to bold. Each numeric value's boldness must be at least as thin as the next smallest number and at least as thick as the next largest number.

See Also:

CSS Tutorial:CSS γραμματοσειρά

CSS Reference Manual:CSS font ιδιότητα

HTML DOM Reference Manual:fontWeight Property

Example

Set the thickness of the font for three paragraphs:

p.normal {font-weight:normal;}
p.thick {font-weight:bold;}
p.thicker {font-weight:900;}

Try It Yourself

CSS Syntax

font-weight: normal|bold|bolder|lighter|number|initial|inherit;

Attribute Value

Value Description
normal Default Value. Defines standard characters.
bold Defines bold characters.
bolder Defines thicker characters.
lighter Defines thinner characters.
  • 100
  • 200
  • 300
  • 400
  • 500
  • 600
  • 700
  • 800
  • 900
Defines characters from thick to thin. 400 is equivalent to normal, and 700 is equivalent to bold.
inherit Specifies that the thickness of the font should be inherited from the parent element.

Technical Details

Default Value: normal
Inheritance: yes
Version: CSS1
JavaScript Syntax: object.style.fontWeight="900"

TIY Example

Setting the thickness of the font
This example demonstrates how to set the thickness of the font.

Browser support

The numbers in the table indicate the first browser version that fully supports this attribute.

Chrome IE / Edge Firefox Safari Opera
2.0 4.0 1.0 1.3 3.5