How to change word spacing in paragraph using CSS?

Answer

To change word spacing in paragraph using CSS, you can set the word-spacing style property for the paragraph elements with the values like 40px, 0.2in, 0.4rem, etc.

CSS Code

The following is the typical CSS code to change word spacing in paragraph in HTML page using tag name p.

Using word spacing in pixels

p {
   word-spacing: 40px;
}

Using word spacing in inches

p {
   word-spacing: 0.2in;
}

Using word spacing relative to parent dimensions

p {
   word-spacing: 0.4rem;
}

Examples

We shall go through some working examples on how to change word spacing in paragraph using CSS. In the following examples, you may change the value of word-spacing and Run the code to visually observe the changes made to the Paragraph elements.

Example 1

This is an example on how to change word spacing in paragraph using word spacing in pixels.

You may edit the following code, and click on Run button.

Example 2

This is an example on how to change word spacing in paragraph using word spacing in inches.

You may edit the following code, and click on Run button.

Example 3

This is an example on how to change word spacing in paragraph using word spacing relative to parent dimensions.

You may edit the following code, and click on Run button.