Understanding CSS Font Weights

This tutorial explains what CSS Font Weights are and how to understand them.

Font Weights allow you to set the thickness of a font using CSS. The size and style of the thickness added to the font will depend on the specific font chosen as some have a large variety of styles others may only have a thin and bold style for example.

With Font Weights you can set specific styles these include:

Normal
Bold
Bolder
Lighter

In effect these do as they suggest and apply that style to the font. You can however go further with font-weights and set a number from 100 – 900 each representing a different level of thickness for the font. For example:

100 – Very Light
200
300
400
500
600
700 – Regular Bold
800
900

Again this will depend on the styles that the font has some may have a font thickness for all of the above options, some may only have a font thickness for bold at 700 so anything above that would be bold for example.

The only other parameters that the this CSS option will accept are:

Inherit
Initial

In both cases they are similar to their applications elsewhere ‘initial’ sets the font to its ‘initial’ default value. ‘Inherit’ sets the font weight to that of the parent class e.g. if that class is 100 the font will be that as well.

So how is this used in a CSS example:

.theclass p {

Font-weight: 400;

}

The above example sets the font weight of the class to 400 which will be a medium weight font.

Further reading:

An introduction to CSS units

We hope this provides you with an idea of getting started with font weights in CSS. We’d appreciate a share or any comments if you found this useful, thanks!

Tech Typed
Tech Typed
Articles: 186

Leave a Reply

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