Front-end Tutorials

Front-end Tutorials

HTMLCSSSassJavaScriptReactJS
CMS Tutorials

CMS Tutorials

WordPress
Tutorials expand

CSS Properties

CSS word-spacing Property

Posted in CSS Tutorial
Updated on Oct 13, 2024
By Mari Selvan
👁️ 18 - Views
⏳ 4 mins
💬 1 Comment
CSS word-spacing Property

Photo Credit to CodeToFun

🙋 Introduction

The word-spacing property in CSS is used to specify the spacing between words in a text element. This property can be particularly useful for improving the readability of text, creating unique design effects, or adhering to specific design guidelines. By adjusting the space between words, you can control the overall appearance and legibility of your text content.

💡 Syntax

The syntax for the word-spacing property is simple and allows you to specify the space between words in various units.

Syntax
Copied
Copy To Clipboard
element {
  word-spacing: value;
}

Here, value can be a length value (e.g., normal, px, em, rem, cm, etc.).

🎛️ Default Value

The default value of the word-spacing property is normal, which means that the spacing between words is the default spacing used by the browser.

🏠 Property Values

ValueDescription
normalThe default spacing between words.
lengthSpecifies the exact spacing between words. Can be a fixed value like px, em, rem, cm, etc.

📄 Example

In this example, we'll increase the word spacing of a paragraph to 10 pixels.

index.html
Copied
Copy To Clipboard
<!DOCTYPE html>
<html lang="en">
<head>
  <meta charset="UTF-8">
  <meta name="viewport" content="width=device-width, initial-scale=1.0">
  <title>CSS word-spacing Example</title>
  <style>
    p {
      word-spacing: 10px;
    }
  </style>
</head>
<body>
  <h1>Paragraph with Custom Word Spacing</h1>
  <p>
    This is an example of text with increased word spacing. Notice how the words are spaced further apart than usual.
  </p>
</body>
</html>

🖥️ Browser Compatibility

The word-spacing property is well-supported in modern browsers, including the latest versions of Chrome, Firefox, Safari, Edge, and Opera. This makes it a reliable property to use for enhancing text layout and design across different web platforms.

🎉 Conclusion

The word-spacing property is a versatile tool for web developers and designers looking to control the spacing between words in their text content.

Whether you're aiming to improve readability, achieve a specific design effect, or adhere to particular design guidelines, adjusting the word spacing can help you achieve your goals. Experiment with different spacing values to see how they impact the look and feel of your text.

👨‍💻 Join our Community:

To get interesting news and instant updates on Front-End, Back-End, CMS and other Frameworks. Please Join the Telegram Channel:

Author

author
👋 Hey, I'm Mari Selvan

For over eight years, I worked as a full-stack web developer. Now, I have chosen my profession as a full-time blogger at codetofun.com.

Buy me a coffee to make codetofun.com free for everyone.

Buy me a Coffee

Share Your Findings to All

Subscribe
Notify of
guest
1 Comment
Oldest
Newest Most Voted
Inline Feedbacks
View all comments
We make use of cookies to improve our user experience. By using this website, you agree with our Cookies Policy
AgreeCookie Policy