CSS Tutorial
Handling Text In CSS
CSS provides several properties that allows you to define
various text styles such as color, alignment, spacing,
decoration, transformation, etc. very easily and effectively.
⚫ The commonly used text properties are:
color
The color of the text is defined by the CSS color property
text-align
The text-align property is used to set the horizontal alignment
of the text.
Text can be aligned in four ways: to the left, right, centre or
justify (straight left and right margins).
text-decoration
The text-decoration property is used to set or remove the
decorations from text.
This property typically accepts one of the following values:
underline
overline
line-through and
none
text-transform
The text-transform property is used to set the cases for a text.
Using this property we can change an element's text content into
uppercase or lowercase letters, or capitalize the first letter of
each word without modifying the original text.
text-indent
The text-indent property is used to set the indentation of the
first line of text within a block of text.
It is typically done by inserting the empty space before the first
line of text.
The size of the indentation can be specified using percentage
(%), length values in pixels, ems, etc.
line-height
The line-height property is used to set the distance between
lines of text.
The value of this property can be a number, a percentage (%),
or a length in pixels, ems, etc.
When the value is a number, the line height is calculated by
multiplying the element's font size by the number. While,
percentage values are relative to the element's font siz
letter-spacing
The letter-spacing property is used to set some extra spacing
between the characters of text.
This property can take a length value in pixels, ems, etc.
It may also accept negative values.
When setting letter spacing, a length value indicates spacing in
addition to the default inter-character space.
word-spacing
The word-spacing property is used to specify additional spacing
between the words.
This property can accept a length value in pixels, ems, etc.
Negative values are also allowed.