Text

CSS allows to set various properties for text such as characters, spaces, words and paragraph.

Text Indentation

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

The possible values are.

ValuesDescription
<length> (e.g. 2px, -1in, 1.2cm)
<percentage>(e.g. 10%, -20%)
inheritThe property is inherited from the parent
Text Alignment

The text-align property is used to to control the alignment of a block of text.

The values of text-align are.

ValuesDescription
left | right | center | justify
<string>It is used for vertical alignment. Applies for table cells.
inheritinherited from parent
Note
Browser do not yet support the <string> alignment.
Text Decoration

The text-decoration property is used to control the decoration (underline, line-through, etc) of a block of text.

The values of text-decoration are.

ValuesDesciption
none | underline | overline | line-through | blink
inheritinherited from the parent
Note
Internet explorer does not support "blink" value.
Text Shadows

The text-shadow property is used to attach shadows to a block of text.

The values of text-shadow are.

ValuesDescription
none
inherit
A list of comma-delimated shadow descriptions
<color><length_x><length_y><length_r><length_x><length_y> - The position of shadow relative to the block. <length_r> - Blur radius. <color> - The color of the shadow.
<length_x><length_y><length_r><color>
example
text-shadow : red 10px 10px; /* Right-bottom*/ 
text-shadow : 10px 10px 5px yellow; /* left-up, blurred*/ 
font-shadow : 5px 5px, -5px -5px;  /* right-bottom and left-up*/
Letter Spacing

The letter-spacing property is used to add extra space between adjacent characters.

The values of letter-spacing are.

ValuesDescription
normal
<length>
inheritinherited from the parent
example
 letter-spacing : 0.5em 
 letter-spacing : 5px 
 letter-spacing : 5pt 
 letter-spacing : 0.5cm
Word Spacing

The word-spacing property is used to add extra space between adjacent words.

The values of word-spacing are.

ValuesDescription
normal
<length>
inheritinherited from the parent
example
word-spacing : -0.2ex 
word-spacing : 5cm
Text Transform

The text-transform property is used to control the capitalization of a block of text..

The values of text-transform are.

ValuesDescription
none
capitalizeTo capitalize the first character of each word.
uppercaseTo capitalize all characters.
lowercaseTo decapitalize all characters.
inheritThe property is inherited from the parent.
example
 text-transform : uppercase 
 text-transform : lowercase
White Spaces

The white-space property is used to control the white spaces inside a block of text.

The values of white-space are.

ValuesDescription
normal
capitalizeReplaces the sequence of white spaces with a space character.
preWhite spaces are considered.
nowrapLine breaks are not considered.
inherit The property is inherited from the parent.
example
<style> 
     white-space : nowrap 
     white-space : pre 
</style>
Related Tutorial
Follow Us
https://www.facebook.com/Rookie-Nerd-638990322793530 https://twitter.com/RookieNerdTutor https://plus.google.com/b/117136517396468545840 #
Contents