text formatting CSS

Text-Color

 

How can we format text in CSS?

We can format text by applying different properties on the text.

Example 1:

<html><head>
<style>h1 {
color: green;
}
</style>
</head>
<body><h1>This is heading 1</h1></body></html>

Output:

This is heading 1


Example 2:

<html><head>
<style>h1 {
color: green;text-align: center;
}
</style>
</head>
<body><h1>This is heading 1</h1></body></html>

Output:

This is heading 1

Explanation:

Properties of text-align:

  • center –Text moves to the center
  • left – Text moves to the left
  • right – Text moves to the right
  • inherit – Inherit value from its parent element
  • justify – Text is decorated in a consistent way and moves to the left and right corners.

Enlist some of the properties of text CSS?

 Property Description
color Set the color to the text
line-height Sets the height for text line
direction Sets the text direction
letter-spacing Sets the spacing between alphabets of the words
 word-spacing Sets the spacing between all words

 

Prof.Fazal Rehman Shamil (Available for Professional Discussions)
1. Message on Facebook page for discussions,
2. Video lectures on Youtube
3. Email is only for Advertisement/business enquiries.