7b. Text styling in CSS

text-align property

Used to set the horizontal alignment of a text.
There are four values for text alignment:-

  • left: align the text to the left.
  • centre: align the text to the centre.
  • right: align the text to the right.
  • justify: spread the text evenly between the left and right margins.
.div1{
          text-align: center;
}

text-decoration property

Used to decorate the text.
There are four values:-

  • overline: adds a line above the text
  • underline: adds a line below the text
  • line-through: Adds a line to the text.
  • none: To remove decoration.

text-transform property

Used to specify uppercase and lowercase letters in a text
There are four values for text-transform:-

  • uppercase: Transform text to uppercase (all capital letters).
  • lowercase: transform text to lowercase (all small letters).
  • capitalise: capitalise the first character from each word.
  • none: To remove text transformation.
p.uppercase{
          text-transform: uppercase;
}

line-height property

The line-height property controls the spacing between the two lines of text.

.Small{
          line-height: 0.7;
}