What is CSS Text Spacing in html

What is CSS Text Spacing

What is CSS Text Spacing in html


This Blog You Will Learn 

ஃ What is CSS Text Spacing in html

ஃ Syntax

ஃ Why CSS Text  Spacing is Important

ஃ Text Spacing controlled using CSS Properties.

ஃ What is CSS Text Spacing in htmlExamples

ஃ Explain Program

ஃ OutPut

What is CSS Text Spacing in html

CSS Text Spacing refers to controlling the space between letters, words, and lines inside text using CSS properties.

Syntax :

selector
{
  letter-spacing: value;
}


Why CSS Text  Spacing is Important

  ✔  Improves Readability
  ✔  Better User Experience
  ✔  Professional Design
  ✔  Responsive Design

Text Spacing controlled using CSS Properties.

1)  letter-spacing
2)  word-spacing
3)  line-height
4)  text-indent
5)  white-space

1) letter-spacing

    Controls the space between characters(letters).

selector

{
  letter-spacing: value;
}

Example:

selector
{
  letter-spacing:5px;
}

Explanation:

  • letter-spacing: 5px;
  • Adds 5pixels space between each letter.

values:

2) Word-spacing

  •  controls space between words.

Syntax :

selector
{
  word-spacing: value;
}

Example 
selector
{
  word-spacing: 10px;
}
  • Adds 10px space between words.
  • useful for improving readability.


3) line-height

  • controls space between lines of text.

Syntax

selector {
  line-spacing:value;
}


Example 
selector {
  word-spacing: 30px;
}

Explanation:
  • Add vertical spacing between lines.
  • Improves readability in paragrapha.

4) text-indent

  • adds space  before the first line of paragraph.

Syntax:

selector {
 text-indent: 10px;
}

Explanation:
  • Moves first line 50px to right
  • used in books and articles.

5] White-space

  •  controls how spaces and line breaks are handled.

Example

selector {
  white-space:nowrap;
}

Explanation
  • nowrap - text will not move to text line.
  • normal -  default behavior.
  • per       -  keep space and line breaks exactly as written.

What is CSS Text Spacing in html

Examples

<!DOCTYPE html>
<html>
<head>
<style>
h2 {
  letter-spacing: 5px;
}

h3 {
  letter-spacing: -2px;
}
</style>
</head>
<body>

 
<h1>CSS Text Spacing</h1>

<h2>What is CSS Text Spacing in html</h2>

<p>CSS Text Spacing refers to the techniques
  used in CSS to control the space between
  letters, words, and lines of text on a
   webpage. Proper text spacing improves
    readability, visual balance, and
     overall design quality. When spacing
     is well-managed, content looks clean,
   professional, and easy to understand.</p>

</body>
</html>

What is CSS Text Spacing in html

Explain Program

Step  1] 

<!DOCTYPE html>

  • This declare the document type.
  • browser that the document is written in html

Step 2]  

<html>.... . </html>

  • html is the root element of the html page.
  •  Every thing inside it is part of the webpage.

Step 3]

<head>

  • <head> section  contains metadata and css styles,not visible content.

  • Contains styles, metadata and page setting 

Step 4

<style> tag Internal CSS Section

<style>
h2 {
  letter-spacing: 5px;
}

h3 {
  letter-spacing: -2px;
}
</style>
  •  Applies to all <h2> elements.
  • letter-spacing: 5px;
  •  5 pixels of space between each letter.
  •  Applies to all <h3> elements
  •  letter-spacing: -2px; 
  • Reduces space between letters.
  • letters move closer together.

Step 5]

   Closing tag


<</style>
</head>

Step 6]

<body> section


 
<h1>CSS Text Spacing</h1>

<h2>What is CSS Text Spacing in html</h2>

<p>CSS Text Spacing refers to the techniques
  used in CSS to control the space between
  letters, words, and lines of text on a
   webpage. Proper text spacing improves
    readability, visual balance, and
     overall design quality. When spacing
     is well-managed, content looks clean,
   professional, and easy to understand.</p>


<h1> - normal spacing 
<h2> - heading has 5px  spacing between letters.
<p>  -  paragraph no space 

Step 7]

closing the Tag

  </body>   </html>


What is CSS Text Spacing in html

Output

What is CSS Text Spacing in html


Related Post :-

CSS Text Shadow property

what is css pseudo-class selector

CSS Attribute selector

Comments

Popular posts from this blog

What Is CSS Text Color in 2026

CSS Padding Property Explained

CSS Outline Color Property in 2026