HTML and CSS Reference
In-Depth Information
Font Size
The font-size property provides the ability to set the size of text using common length
values, including pixels, em units, percentages, points, or font-size keywords.
Here the CSS is setting a font-size of 14 pixels on the <body> element:
1. body {
2. font-size: 14px;
3. }
Font Style
To change text to italics, or to prevent text from being italicized, we'll use the font-
style property. The font-style property accepts four keyword values: normal , it-
alic , oblique , and inherit . Of these four, the most commonly used are italic
(sets text to italic) and normal (returns text to its normal style).
The following CSS sets all elements with a class of special to include a font-style
of italic :
1. .special {
2. font-style: italic;
3. }
Font Variant
It doesn't happen often, but occasionally text will need to be set in small capitals, also
known as small caps. For this specific case we'll use the font-variant property. The
font-variant property accepts three values: normal , small-caps , and inherit .
The most typically seen values are normal and small-caps , which are used to switch
typefaces between normal and small caps variants.
To switch all elements with a class of firm , we'll use a font-variant of small-
caps :
Click here to view code image
1. .firm {
2. font-variant: small-caps;
3. }
Search WWH ::




Custom Search