Oops! It appears that you have disabled your Javascript. In order for you to see this page as it is meant to appear, we ask that you please re-enable your Javascript!

text formatting in css in web development

Last modified on May 26th, 2018 at 2:06 pm

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?

 PropertyDescription
colorSet the color to the text
line-heightSets the height for text line
directionSets the text direction
letter-spacingSets the spacing between alphabets of the words
 word-spacingSets the spacing between all words

 

Prof. Fazal Rehman Shamil
Researcher, Publisher of International Journal Of Software Technology & Science ISSN: 2616-5325
Instructor, SEO Expert, Web Programmer and poet.
Feel free to contact.