Spaces, tabs, and new lines (white space) in the source code are collapsed down to a single space. As an example:
<p> This is [tab] a test imonial.</p>
Displays as:
This is a test
imonial.
You can see that the new lines were converted to a single space. If you don’t want white space to collapse you can use the <pre>
tag. With CSS3, we have a lot more options for controlling line breaks and spaces. See below...
The <wbr>
tag will give the browser a hint where it can break a very long set of words with no spaces in it. By adding <wbr>
you can define logical areas where the text can start a new line.
window.open('myPage.html',
The above line uses the code:
window.open('myPage.html',<wbr>
Warning: IE8 will ignore <wbr>
when running in standards-mode. The work around is to use a zero-width space instead.
Multiple white space characters (spaces and line breaks) will normally collapse down to a single space. If you would like multiple spaces, for example two spaces between sentences, then use
in your code. The easiest way to get it is with the keyboard shortcut: Command Shift Space
.
Go there. Now.
<p>Go there. Now.</p>
Stephen Morley has done a great job of explaining this topic.
http://code.stephenmorley.org/html-and-css/white-space-handling/
The CSS2 properties/values related to white space are:
white-space: normal | pre | nowrap | pre-wrap | pre-line