CSS Letter Spacing

Letter spacing property allows us to control the amount of space between each letters in a word.

The above code sets 2 pixel space between each letter in a word .

The following HTML page dispalys a normal letter spacing line and 2px letter spacing line.

output

CSS letter space

CSS Word spacing

Word spacing property allows us to control the amount of space between each word in a line.

The above code sets 2 pixels space between each word in a line.

The following HTML page dispalys a normal word spacing line and 10px word spacing line.

output

CSS word spacing

CSS White Space

If you put so many spaces between words in a markup page, the browser will display only one space and other spaces will ignored also ignored the line break. This is known as white space collapsing .

CSS white space

CSS pre

When you use the pre keyword in markup, you can see the output content exactly as it appears in your markup.

The following document dispalys two paragraph, one with normal paragraph and the next paragraph styled with white-space pre.

output

CSS pre

CSS nowrap

The white-space nowrap breaks text onto a new line only if explicitly told to with a < br > element, otherwise text does not wrap.

For a better layout it is better to avoid white-space nowrap because it can cause layout problems when your text overlaps or pushes other content out of the way.

The following document dispalys two paragraph, one with normal paragraph and the next paragraph styled with white-space nowrap.

output

CSS nowrap

In the above image yo can see the second line overlap the screen area, because it used white-space:nowrap.