Help:Whitespace

Whitespace is any part of text which doesn't contain a visible character. It generally acts normally as you would expect on Fandom, but there are some situations where whitespace acts counter-intuitively, especially if entered using the classic editor or source mode. This page lists some of those situations, and how to avoid them.

Line breaks
To get a line break to display on the page, two line breaks (or two presses of the enter/return key on your keyboard) are needed. If you only use one line break, the text after the line break will just continue on next to the text above it as if separated by a normal space character. For example: Hello World turns into:

Hello World

Hello

World turns into:

Hello

World

However, single line breaks don't follow this pattern when part of a list of either ordered or unordered type. For example, using an unordered list: List ended. will display as:
 * Item 1
 * Item 2

List ended.
 * Item 1
 * Item 2

This specific problem is often encountered when a single line space is used inside a template for information layout in the source code, causing some templates to force a line break when used inside a list.

Whitespace at the beginning of lines
If a space is added at the beginning of a line or paragraph, all the following text will be placed inside a one line high box. For example: Hello world! Did you know that you can learn more about links at Help:Link? turns into:

Hello world! Did you know that you can learn more about links at Help:Link?

This box is similar to the box formed by pre tags, however, unlike the pre tags, it does parse wikitext.

Multiple spaces in a row
If you intend to separate text with multiple spaces, all those spaces will be condensed down to one single space instead of giving the desired spacing. For example: White          Space turns into: __NOWYSIWYG__ White          Space

This can be avoided by using what is known as a non-breaking space which doesn't collapse when a page is displayed to the reader. This is produced by typing &amp;nbsp;. For example: White&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;Space displays as:

White        Space

Note that this is only the case for normal space characters. Line breaks won't collapse on themselves with the exception of when a single line break is used, as documented above.

Indentation
Whitespace and non-breaking space characters should be avoided for adding indention to a block of text. The wikitext equivalent, a colon at the beginning of a newline, should be used instead. The level of indentation can be changed using the number of colons placed: This is a line of text.
 * This is an indented line of text.
 * This line of text is more indented.

displays as:

This is a line of text.
 * This is an indented line of text.
 * This line of text is more indented.

Note that if you're indenting the text, the normal line-break collapsing rules don't apply and you can put a line of different indentation directly under another line.

Further help and feedback
ja:ヘルプ:空白と改行