| |
| Overview |
| |
In this chapter you will learn :
- How to format text using various style options
- How to change color of the text
- How to set the direction of text
- Decorating the text
- Handling white spaces
|
| |
| |
| |
CSS gives you a range of style options to enable formatting of text. These style options can be applied easily
on your document. They are given below:
Color
- CSS has several options for defining colors of text.
- CSS makes it possible to change the color of the text.
Example |
pink{ color : pink}
The color is pink now
H1{ color : #000080}
|
| |
-
Colors can also be defined by using RGB values, by simply entering the values for amounts of Red, Green, and Blue.
Direction
- It sets the direction of text.
- It could have either ltr (i.e. left to right) or rtl (i.e. right to left) values.
Example |
|
| div { direction : rtl} |
|
This has been written from right to left by setting the direction of the text |
| |
Letter Spacing
- The letter spacing property increases or decreases the spaces between characters.
- The exact value of the spacing can be specified between characters.
- Negative values are permitted.
Example |
|
p{ letter-spacing : 10px;}
Here letter spacing is 10 pixel.
p{ letter-spacing : -1.5px;}
Here letter spacing is -1.5 pixel. |
|
Text Align
- This property can be applied to assign alignment to the text.
- The text-align property can have values left, right, center, and justify.
- The default value of text-align is left.
Example |
|
h1 { text-align :center;}
CENTER ALIGNED |
|
Text Decoration
- This property enables decoration of the text.
- Text can be decorated using values: none, underline, overline, line-through, and blink.
None - This defines a normal text.
Underline - This defines a line under the text.
Overline - This defines a line over the text.
Line-through - defines a line through the text.
Blink - defines a blinking text.
Example |
|
p {text-decoration: underline}
UNDERLINE
p {text-decoration: overline}
OVERLINE
p {text-decoration: line-through}
LINE-THROUGH |
|
|