CSS Text

CSS Text

This chapter teaches you how to manipulate text using CSS properties. You can set the 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 on 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.

 

1. Text Color:

A possible value could be any color name in any valid format.

CODE:

 

Result:

2. Set the Text Direction:
The following example demonstrates how to set the direction of a text. Possible values are ltr or rtl.

CODE:

 

Result:

3. Word Spacing:
The word-spacing property is used to specify the space between the words in a text. The following example demonstrates how to increase or decrease the space between words:

CODE:

 

Result:

4. Text Decoration
The text-decoration property is used to set or remove decorations from the text.

CODE:

 

Result:

 

5. Text Indentation
The text-indent property is used to specify the indentation of the first line of a text:

CODE:

 

Result:

 

5. Line Height
The line-height property is used to specify the space between lines:

CODE:

 

Result:

6. Text Shadow
The text-shadow property adds a shadow to text.

CODE:

 

Result:

All CSS Text Properties

 

 

You may also like: CSS Outline

Leave a Comment

Your email address will not be published.