Back to the index.
The white-space declaration allows you to tweak the wrapping of an element. The tab-size declaration allows you to set the width of tabs.
Test sheet:
p.test { border: 1px solid #000000; padding: 5px; width: 300px; }
I add the relevant white-space
value inline.
This value suppresses all line breaks in the element, except where it contains <br>
s or <wbr>
s.
This is the test paragraph. It has all kinds of odd tabs and spacing in the HTML source code. Should they be preserved?
This value makes the element behave as a <pre>
: all line breaks, tabs and other oddities of the source code
are literally followed.
This is the test paragraph. It has all kinds of odd tabs and spacing in the HTML source code. Should they be preserved?
This value behaves as the pre
value, except that it adds extra line breaks to prevent the text breaking out of
the element's box.
This is the test paragraph. It has all kinds of odd tabs and spacing in the HTML source code. Should they be preserved?
This value ignores tabs and multiple spaces, but it breaks off the text at hard returns in the source code, as well as when it's necessary to prevent the text from breaking out of its box.
This is the test paragraph. It has all kinds of odd tabs and spacing in the HTML source code. Should they be preserved?