How to Set Fonts Directly with CSS

This tutorial gives you an introduction to setting fonts directly within CSS.

In this tutorial we’re going to quickly explore setting fonts with CSS. It’s a really nice way to customise specific titles, areas of text or even the overall look of an entire class.

To set a font you can use:

Font-Family: ‘Montserrat, Sans Serif’;

In the above example the font family declares the font of choice, which in this case is Montserrat. We then set the type of font so that if the browser can’t read the font / display it then it uses a similar font within the same category which in this case is Sans Serif.

So to add this to a class it would look something like this:

.your-class-name {

Font-Family: ‘Montserrat, Sans Serif’;

}

Another example would be setting an entire tag to this specific font for example:

H3 {
Font-family: ‘Montserrat, Sans Serif’;
}

The fonts that you’re able to use will depend on the theme that you pick and whether any specific fonts are installed with it or whether you’ve added an additional fonts library to your website.

Further reading:

Adding CSS to WordPress

We hope this gives you with an idea of how to begin with setting fonts via 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 *