Text Properties:
Text properties in CSS are used to control the appearance, alignment, spacing, decoration, and transformation of text on a webpage.
1.color:
color property is used to set the color for the text inside an element.
p{
color:red;
}
2.text-align:
text-align property is used to align the text horizontally.
h1{
text-align:center;
}
Values:
- left
- right
- center
- justify
3.text-decoration:
text-decoration property is used to add or remove decorations such as underline, overline or line-through from the text.
#heading{
text-decoration:underline;
}
Values:
- none – Removes any text decoration
- underline – Adds a line below the text
- overline – Adds a line above the text
- line-through – Adds a line through the middle of the text
4. text-transform:
text-transform property is used to change the text from one case to another.
h2 {
text-transform:uppercase;
}
Values:
- uppercase
- lowercase
- capitalize
- none
5.letter-spacing:
letter-spacing property is used to provide the space between the letters in the text.
p {
letter-spacing: 2px;
}
6.word-spacing:
word-spacing property is used to provide space between the words in the text.
p {
word-spacing: 5px;
}
7.text-indent:
text-indent property is used to adding space at the beginning of a line or paragraph.
p {
text-indent: 50px;
}
Example:
Without Indentation:
This is the first line of the paragraph.
This is the second line of the paragraph.
With text-indent: 50px:
This is the first line of the paragraph.
This is the second line of the paragraph.
Top comments (0)