CSS Text
Text Color
color
property is used to set the color of the text. The color is specified by:- a color name - like "red"
- a HEX value - like "#ff0000"
- an RGB value - like "rgb(255,0,0)"
Example
color: blue;}
h1 {
color: green;}
Text Alignment
text-align
property is used to set the horizontal alignment of a text.Example
text-align: center;}
h2 {
text-align: left;}
h3 {
text-align: right;}
text-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 (like in magazines and newspapers):Example
text-align: justify;}
Text Decoration
text-decoration
property is used to set or remove decorations from text.text-decoration: none;
is often used to remove underlines from links:Example
text-decoration: none;}
text-decoration
values are used to decorate text:Example
text-decoration: overline;}
h2 {
text-decoration: line-through;}
h3 {
text-decoration: underline;}
Text Transformation
text-transform
property is used to specify uppercase and lowercase letters in a text.Example
text-transform: uppercase;}
p.lowercase {
text-transform: lowercase;}
p.capitalize {
text-transform: capitalize;}
Text Indentation
text-indent
property is used to specify the indentation of the first line of a text:Example
text-indent: 50px;}
Letter Spacing
letter-spacing
property is used to specify the space between the characters in a text.Example
letter-spacing: 3px;}
h2 {
letter-spacing: -3px;}
Line Height
line-height
property is used to specify the space between lines:Example
line-height: 0.8;}
p.big {
line-height: 1.8;}
Text Direction
direction
property is used to change the text direction of an element:Example
direction: rtl;}
Word Spacing
word-spacing
property is used to specify the space between the words in a text.Example
word-spacing: 10px;}
h2 {
word-spacing: -5px;}
Text Shadow
text-shadow
property adds shadow to text.Example
text-shadow: 3px 2px red;}