Text

Specifying Typefaces (font-family)

The font-family property allows you to specify the typeface that should be used for any text inside the element(s) to which a CSS rule applies. The value of this property is the name of the typeface you want to use.

Size of Type (font-size)

The font-size property enables you to specify a size for the font. There are several ways to specify the size of a font. The most common are:

1-pixels: are commonly used because they allow web designers very precise control over how much space their text takes up. The number of pixels is followed by the letters px.

2-percentages: The default size of text in browsers is 16px. So a size of 75% would be the equivalent of 12px, and 200% would be 32px.

3- Ems: An em is equivalent to the width of a letter m.

font size

More Font Choice (@font-face)

@font-face allows you to use a font, even if it is not installed on the computer of the person browsing, by allowing you to specify a path to a copy of the font, which will be downloaded if it is not on the user’s machine.

@font-family

Bold (font-weight)

The font-weight property allows you to create bold text. There are two values that this property commonly takes:

  • normal: This causes text to appear at a normal weight.

  • bold: This causes text to appear bold.

Italic (font-style)

If you want to create italic text, you can use the font-style property. There are three values this property can take:

1-normal: This causes text to appear in a normal style (as opposed to italic or oblique)

2- italic: This causes text to appear italic.

3- oblique: This causes text to appear oblique.

Alignment (text-align)

The text-align property allows you to control the alignment of text. The property can take one of four values:

1- left: This indicates that the text should be left-aligned.

2-right: This indicates that the text should be right-aligned.

3- center: This allows you to center text.

4- justify: This indicates that every line in a paragraph, except the last line, should be set to take up the full width of the containing box.