text formatting in css in web development

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

 

Fazal Rehman Shamil
Welcome to all friends. The reason for our success is only your love for T4Tutorials. Our team is always available to answer your queries regarding any kind of confusions or discussion regarding your study and career matters. For discussion with us please join our facebook group "T4Tutorials.com". The link of the group is mentioned below. Thanks and love to all for connecting with us. We are nothing without you. Love you all.....
https://web.facebook.com/groups/2066136233601097/