CSS Basics CSS structure / syntax CSS Text CSS font CSS links CSS Images CSS Tables Css Position layout

Text color

Text can format using different text properties :

The color property is used to change the color of the text A color can be specified with CSS as:

  • a color name - like "green"
  • a HEX value - like "#093"
  • an RGB value - like "rgb(0,153,51)"

Text Alignment

The text-align property is used to set thel alignment of a text.
A text can be left or right aligned, centered, or justified.
Withtext-align property is set to "justify", each line is stretched so that every line has equal width, and the left and right margins are straight.

Text Decoration

The text-decorationproperty is used to set or remove decorations from text.
The value text-decoration: none; is often used to remove underlines from links.

Text Transformation

The text-transform property is used to change the text into Uppercase and Lowercase or to capitalize the first letter of each word.

Text Indentation

The text-indent property is used to set the indentation of the first line of a text.

Letter Spacing

The letter-spacing property is used to specify the space between the characters in a text.

If you want the close the words then set the value to negative which will decrease the space between the characters.

Text Direction

The direction property is used to set the text direction of an element.

Text Shadow

The text-shadow property is used add shadow to text.

This may not be supported by all the browsers.

Word Spacing

The word-spacing property changes the space between the words in a text.


Try It Yourself