You’re viewing an archive of outdated material. Visit The Web Standards Project’s updated site to learn about our current mission.

White-space Demonstration

Example 1

Here is a poem, where the layout of the text is important. The white-space property has been set to pre to preserve the lie of the lines.

A Poem.

A Poem, A Poem -- he wanted a poem! A Poem, A Poem -- but why a poem?

A poem was needed, to show what Op'ra did upon encountering 'white-space', a property of css!

It was to be -- at least; so said he -- a great work of art... one with liver, and heart.

Liver? Heart? Yes, one may well ask, for how would organs help, a poem, in its task? "Metaphors!" Cries the scholar -- who had no idea.

But why, he is right! For out of the night Came a poem -- with liver, and heart! (Although no work of art).

-- Anonymous

Example 2

Another case where white-space could be used is with the prevention of wrapping -- namely in the use of its nowrap value. Authors currently use a Netscape extension, NOBR, to achieve this effect. However, NOBR is non-standard and forces authors to include presentational information inside their documents, instead of keeping presentation and structure separate. This next line should not wrap (as you may have guessed).

This line should not wrap, however slim the browser window may be. It should go on, and on, and on horizontally, never splitting or wrapping. This is very important. Is that understood? Hey! I'm speaking to you! I said, do you understand? No wrapping! This line should go on, and on, and on! Nothing should be allowed to wrap this line! Wrapping this line is a clear breach of the CSS1 specification! Do you hear me!?