OBJECTIVES
❖ Identify the properties of text
❖ Know the use of text properties
LESSON PREREQUISITE
None
LESSON PROPER
CSS Text
Text Color
The color property is used to set the color of the text.
The color is identified by:
a color name - like "red"
a HEX value - like "#ff0000"
an RGB value - like "rgb(255,0,0)"
Example:
Code:
p {
color: red;
}
Text Alignment
The text-align property is used to set the horizontal alignment of a text. The three common alignments of text are center, left, and right.
Example:
Code
h1 {
text-align: center;
}
h2 {
text-align: left;
}
h3 {
text-align: right;
}
Text Decoration
The text-decoration property is used to set or remove decorations from the text.
Example:
Code:
h1 {
text-decoration: overline;
}
h2 {
text-decoration: line-through;
}
h3 {
text-decoration: underline;
}
Text Transformation
The text-transform property is used to turn a text into uppercase or lowercase letters, or capitalize the first letter of each word.