CSS FONT

The CSS font is used to specify the font style of the text, ie the font, family, weight, size.

CSS Font Family

The property font-family is used to specify the font family of the text. Several families are usually defined by the client browser if you are viewing the web page does not support any particular family.

For example, if we want all paragraphs have the family "Times New Roman" or else the family "Times" or "serif", we define the following CSS:

p {font-family:"Times New Roman", Times, serif;}

FONT STYLE CSS

The property font-style is used to make text italic or oblique.

Possible values and their definition in CSS

{font-style:normal;} {font-style:italic;} {font-style:oblique;}

CSS FONT SIZE

The property font-size is used to set the text size.

There are two steps to establish the size of the text.
"px" to express pixels
"em" as recommended by the W3C.

The default value for "px" is "16px".
The default value for "em" is "1em"

Sample sizes expressed in "px"

{font-size:40px;} {font-size:20px;} {font-size:12px;}

Their counterparts in "em", which are obtained by dividing the value "px" by 16.

{font-size:2.5em;} /* 40px / 16 = 2.5em */ {font-size:1.25em;} /* 20px / 16 = 1.25em */ {font-size:0.75em;} /* 12px / 16 = 0.75em */

CSS FONT WEIGHT

The property font-weight is used to express the thickness of the text, which can be normal, thick, thin, or expressed as a numerical value.

Examples:

{font-weight:normal;} {font-weight:bold;} {font-weight:lighter;} {font-weight:500;}

The numerical value can range from 100 to 900.

The normal value has a default value of 400.