CSS Fonts

CSS Fonts


CSS Fonts - 
You can use any font installed on your system for styling your website, but you should use a web-safe font. 
These are fonts that are generally considered safe to use because they are available on most users' systems.
Now the following table shows the generally accepted web-safe fonts along with their generic font family names.
There are several CSS properties that control basic text styling. We’ll discuss a few of them in this section.
CSS font-family Property-
The font-family property sets the font to use for the element's text. This font is inherited by descendant elements.
font-family can be specified as a single value, the name of the font to use. 
More commonly, a comma-separated list of fonts is given.
The browser will try each font, starting with the first, until a match is found. 
Generally, the list starts specific and gets more general. 
The last font family in the list is typically a generic one like monospace or sans-serif, where the browser will use a fallback font that approximates the desired appearance. Font names containing spaces should be enclosed in quotes.
Syntax - 
Font-family: values;
Now we will see examples - 
Example - 
.hello
{

font-family: Georgia, 'Times New Roman', serif;

}
In the above-given example, the browser will try Georgia first. If Georgia is unavailable, it will try Times New Roman. Lastly, if that is not available, it will fall back to a built-in generic serif font.
Example - 
Output -