CSS Word Spacing – How to Do It Right

Photo of author

Marilena

Bookmark this post

Hey everyone! 😃 In this post, we’ll take a look at the CSS property called word spacing. It controls the horizontal distance between words in a text. By default, the CSS word spacing is set to 0px, which is known as normal (word-spacing: normal). If you increase the spacing value, the distance between words will get bigger, while decreasing it will make the spacing smaller.

Advertisement

Let’s take a closer look at this simple yet useful CSS property to understand it better.

HTML structure for CSS word spacing

Let’s begin by creating an HTML document. In it, we include three headings <h1> that display the text “Hello World”. The first heading has the class .spacing-normal, the second heading has the class .spacing-big, and the third heading has the class .spacing-small. All headings contain the same text, as it allows an easy comparison. 👌

<h1 class="spacing-normal">Hello World</h1>
<h1 class="spacing-big">Hello World</h1>
<h1 class="spacing-small">Hello World</h1>
HTML

CSS structure for CSS word spacing

For our CSS structure, we set the word-spacing property for all three classes and differentiate them by assigning different values.

.spacing-normal {
  word-spacing: normal;
}

.spacing-big {
  word-spacing: 100px;
}

.spacing-small {
  word-spacing: -50px;
}
CSS

The image below shows the impact of different word spacing values used for each of our headings. The first heading has normal word spacing, while the second has a larger distance between words due to the increased word spacing value. Similarly, the third heading has a narrower spacing resulting from the decreased value.

🔖 It is important to avoid using word spacing values that are either too large or too small.

In summary, this image demonstrates how adjusting the spacing between words can impact text appearance. It’s amazing how even small changes can have a significant impact. Isn’t it? 😎

🌼 Hope you found my post interesting and helpful. Thanks for being here! 🌼

DigitalOcean Referral Badge
guest
0 Comments
Inline Feedbacks
View all comments

Continue reading

Front, Programming

How box-shadow Works (Made Simple)

Front, Programming

How to Make a Transparent Button Using HTML and CSS

Front, Programming

How To Create Stunning Vibrant Neon Effect – CSS Only

Front, Programming

How inset Works in box-shadow (Made Simple)

Front, Programming

CSS Water Drop Effect: How to Make Text Look Wet & Glossy – A Step by Step Guide

Front, Programming

How To Create A Stunning Gray CSS Water Drop

Front, Programming

Grayscale Backdrop Filter: A Useful Tool To Make Grayish Backgrounds

Front, Programming

Awesome CSS Grayscale Filter – How to Upgrade Images

Front, Programming

Learn CSS Grayscale Filter the Easy Way: A Complete Guide

Front, Programming

Make a Unique Folded Corner Effect – Step By Step Guide

Front, Programming

CSS Radial Gradient Techniques: How To Make Colorful Infinite Loops

Front, Programming

CSS Linear Gradient Techniques: How To Make Colorful Line Drawings

Subscribe to our newsletter

Dive into the Fun Side of Tech! Posts, News, and More Delivered to Your Inbox!

Intuit Mailchimp