FANDOM


Whitespace is any part of text which doesn't contain a visible character. It generally acts normally, 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

displays as:

Hello World

By comparison:

Hello

World

displays as:

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:

* Item 1
* Item 2
List ended.

will display as:

  • Item 1
  • Item 2

List ended.

When a line space is used inside a template it may end up being passed through to the article page, which can cause an unexpected line break when used inside a list. To prevent this, avoid unwarranted line breaks in templates.

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:Links]]?

displays as:

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

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

displays as:

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  . For example:

White         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 mentioned earlier.

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.

See also

Further help and feedback