Managing Spacing Between Words with CSS wordspacing Property

CSSWeb DevelopmentFront End Technology

By defining the CSS word-spacing property, we can set the amount of white space between the words.

The following examples illustrate CSS word-spacing property.

Example

 Live Demo

<!DOCTYPE html>
<html>
<head>
<style>
div {
   margin: 2%;
   padding: 2%;
   background-color: mediumorchid;
   color: ivory;
   word-spacing: 2.2cm;
}
div:last-of-type {
   word-spacing: normal;
}
</style>
</head>
<body>
<div>I Don't Care! I Love It!</div>
<div>I Don't Care! I Love It!</div>
</body>
</html>

Output

This will produce the following result −

Example

 Live Demo

<!DOCTYPE html>
<html>
<head>
<style>
article {
   margin: 2%;
   padding: 2%;
   background-color: azure;
   word-spacing: 2.2cm;
}
article:last-of-type {
   word-spacing: normal;
}
</style>
</head>
<body>
<article>tldr; this article doesn;t mean anything</article>
<article>0123456789 is not a phone number</article>
</body>
</html>

Output

This will produce the following result −

raja
Published on 12-Mar-2021 11:23:57
Advertisements