The font-family property specifies the typeface for an element. The font-family property can hold several font names. If the browser does not support the first font, it tries the next font.
Remember to include the "fallback" or default font at the end of the list. The fallback font does not need quote marks. The options are: serif, sans-serif, cursive, and monospace.
p{
font-family:'Arial', 'Verdana', sans-serif;
}
In this example, the browser will use Arial if that font is supported. If not, it will try Verdana next. If neither of those fonts are supported, the browser will use the whatever sans-serif font the user's computer has.
The font-size property sets the size of the text element.
p{
font-family:'Arial', 'Verdana', sans-serif;
font-size:36px;
}
This example takes the font specified above and changes the size to 36 pixels.
We will start with pixels as a unit of font size to keep things simple. Other times, em and rem are the preferred units because they are scalable.
The text-transform property specifies the capitalization of text.
p{
font-family:'Arial', 'Verdana', sans-serif;
font-size:36px;
text-transform:uppercase;
}
This example takes the font family and size specifications from above, and changes the paragraph text to uppercase.
The font-weight property is used for quick bolding.
p{
font-family:'Arial', 'Verdana', sans-serif;
font-size:36px;
color:white;
background-color:red;
text-transform:uppercase;
font-weight:bold;
}
This example makes the paragraph text bold.
Note that this example uses the same font family, font size, and capitalization specifications as the previous examples. Text color and background color are also specified here using the color and background-color properties, respectively.
The font-style property is used for quick italicizing.
p{
font-family:'Arial', 'Verdana', sans-serif;
font-size:36px;
color:white;
background-color:red;
text-transform:uppercase;
font-weight:bold;
font-style:italics;
}
This example adds italics to the list of style specifications.
There are many more CSS properties specifically for fonts, but also hundreds more in general. They can be found in books, other online references, and through some simple Googling. Section 2.5 has a few to get you started.