HTML CSS SQL Meta tag Generator ScrollBar design Generator Encode Decode images

CSS Basics

Introduction Syntax Selectors Attribute Selectors Specificity Combinators !important Comments Colors

CSS Need to Know

Box Model Pseudo-class Pseudo-element Inline-block Math Functions Max and Min Opacity Outline Overflow Z-index Float

Most used

Align Backgrounds Borders Text Units Padding Margins Position Tables Display Fonts Lists Height and Width

CSS Reference

CSS Properties reference CSS Pseudo-Classes reference CSS Pseudo-Elements reference CSS Selector reference

CSS font-family

The CSS font-family property specifies the font family of text content. It allows you to specify a prioritized list of font family names or generic family names for the browser to use when displaying text.

The font-family property should be applied to the elements you want to style the text for, such as headings, paragraphs, or individual span elements.

Let's take a look at an example:

Result:

This is an example of text styled with different font-family values:

This text is styled with the font family 'Arial'.

This text is styled with the font family 'Verdana'.

This text is styled with the font family 'Courier New'.

In the example above, we have specified different font families for each paragraph using the font-family property. The browser will attempt to use the first font family in the list, and if it is not available, it will move on to the next font family in the list.

You can also specify generic font family names as fallback options in case a specific font family is not available on the user's system. The generic family names are serif, sans-serif, monospace, cursive, and fantasy.

It is important to note that not all font families are available on all systems, so it is a good practice to provide a fallback font family or use generic font families to ensure that your text content is displayed correctly across different devices and browsers.

#tower-of-pisa {
	font-style: italic;
}