Conditional Rendering in React Complete Guide with Examples 2026

Image
  Conditional Rendering in React Conditional Rendering is one of the most useful concepts in React. It means showing different content on the screen depending on a condition. For example: If a user is logged in → show Logout If a user is not logged in → show Login If a student has passed → show Congratulations If a product is available → show Buy Now If data is loading → show Loading... React does not have a separate if rendering tag. Instead, we use normal JavaScript conditions such as if, the ternary operator, &&, and switch to decide what should appear in the UI.

What is CSS Text Spacing in HTML? Complete Beginner’s Guide

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
ஃ structure diagram examples
ஃ 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.
ஃ structure diagram examples
What is CSS Text Spacing in html


What is CSS Text Spacing in html

Example

<!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 :-

Comments

Popular posts from this blog

HTML Tag

CSS Text Color Explained with Syntax and HTML Examples

HTML Input Type Submit Syntax and Example