CSS Text Tutorial

G:hackHTMLmyCSS-Tutorial15- text�1.jpg

In the next couple of sections we’ll explain those properties that apply to text content and demonstrate what each property does.

To sum up, here’s the list of properties that we can apply to texts:

  • font-family: use this property to set the typeface of a text.
    Example: font-family: arial;

  • font-size: use this property to change the size of a text.
    Example: font-size: 24em;

  • font-weight: using this property you can create a bold text.
    Example: font-weight: bold;

  • font-style: this property can change the style of your text.
    Example: font-style: italic;

  • text-transform: when we want to transform a text to upper case or
    lowercase or capitalize it, we can use this property. Example:
    text-transform: uppercase;

  • text-decoration: when you want to decorate a text for example set
    an ender-line to it we can use this property. Example: text-decoration:
    underline;

  • line-height: We can increase or decrease the white space between
    each line using this property. Example: line-height: 200%;

  • letter-spacing: using this property we can increase or decrease
    the space between each letter in a text. Example: letter-spacing:
    0.2em;

  • word-spacing: using this property we can increase or decrease the
    space between each word in a text. Example: word-spacing: 1em;

  • text-align: This property is used to control the alignment of a
    text. Values for this property can be left, right, center, justify.
    Example: text-align: right;

  • vertical-align: Using this property, we can control the vertical
    alignment of a text. Some of the values for this property are: top,
    middle and bottom. Example: vertical-align: top;

  • text-indent: If we want to indent the first line of a paragraph,
    we can use this property. Example: text-indent: 2em;

  • text-shadow: When we want to create a shadow around a text that
    shape the style of the text itself, we use this property. Example:
    text-shadow: 0.1em 0.2em 0.1em blue;

(We set 3 to 4 values assign to this property. Each of these values will be explained in text-shadow section)