This chapter teaches you how to manipulate text using CSS properties. You can set following text properties of an element −
The color property is used to set the color of a text.
The direction property is used to set the text direction.
The letter-spacing property is used to add or subtract space between the letters that make up a word.
The word-spacing property is used to add or subtract space between the words of a sentence.
The text-indent property is used to indent the text of a paragraph.
The text-align property is used to align the text of a document.
The text-decoration property is used to underline, overline, and strikethrough text.
The text-transform property is used to capitalize text or convert text to uppercase or lowercase letters.
The white-space property is used to control the flow and formatting of text.
The text-shadow property is used to set the text shadow around a text.
The color property is used to set the color of the text. The color is specified by:
The following example demonstrates how to set the direction of a text. Possible values are ltr or rtl.
The text-align property is used to set the horizontal alignment of a text.A text can be left or right aligned, centered, or justified.The following example shows center aligned, and left and right aligned text (left alignment is default if text direction is left-to-right, and right alignment is default if text direction is right-to-left):
The following example demonstrates how to set the space between characters. Possible values are normal or a number specifying space.
The text-transform property is used to specify uppercase and lowercase letters in a text.It can be used to turn everything into uppercase or lowercase letters, or capitalize the first letter of each word:
The following example demonstrates how to set the space between words. Possible values are normal or a number specifying space.
The text-indent property is used to specify the indentation of the first line of a text:
The line-height property is used to specify the space between lines:
The text-shadow property adds shadow to text.The following example specifies the position of the horizontal shadow (3px), the position of the vertical shadow (2px) and the color of the shadow (red):
The following example demonstrates how to indent the first line of a paragraph. Possible values are % or a number specifying indent space.
The following example demonstrates how to decorate a text. Possible values are none, underline, overline, line-through, blink.