CSS Text Properties
CSS text properties are used to format text and style the text. Important properties used for manipulating text are:-
Text Color
Color sets the colour of a text. 'color' can be specified with the following ways:-
- Using name - eg: color:red;
- Using hexadecimal value - eg: color:#FF0000;
- Using RGB value - eg: color:rgb(255,0,0);
Eg:
<style>
p
{
color:red;
}
</style>
<p>Text Properties</p>
Text Alignment
Text alignment (text-align) property is used to align the text horizontally. Text alignment can be left, center, right or justify.
Eg:
<style>
p
{
text-align:center;
}
</style>
<p>Text Properties</p>
Text Decoration
It adds decoration to text. Text decoration can be underline, overline, line-through or none.
Eg:
<style>
p
{
text-decoration:underline;
}
</style>
<p>Text Properties</p>
Letter Spacing
It defines the spacing between the characters of a block of text. We can specify letter spacing in pixels ('px') or em.
Eg:
<style>
p
{
letter-spacing:10px;
}
</style>
<p>Text Properties</p>
Text Transform
The CSS text-transform property is used to control the text uppercase and lowercase rendering. It can take the values lowercase, uppercase, capitalize, none or inherit.
Eg:
<style>
p
{
text-transform:uppercase;
}
</style>
<p>Text Properties</p>