"white-space: pre;" and IE

Do you have a question? Post it now! No Registration Necessary.  Now with pictures!

Threaded View
I have the following rule:
#textarea { white-space: pre; }

I also have this:
<td id="textarea">
The files in this directory are necessary for GVim Portable to
There is normally no need to directly access or alter any of the
within these directories.

Notice the newlines both at the start and at the end of the text
block. IE just ignores them. FF2 handles them correctly.

Re: "white-space: pre;" and IE

On Wed, 30 May 2007 02:54:07 GMT  scribed:

Quoted text here. Click to load it

Okay.  What's the point, though?

He who laughs last sounds like an idiot.

Re: "white-space: pre;" and IE

Scripsit noagbodjivictor@gmail.com:

Quoted text here. Click to load it

As usual, you should have posted the URL, as you will see...

(And you should not use a name like "textarea" - it is just confusing, since
HTML has the <textarea> element.)

Quoted text here. Click to load it

Why do you want to use preformatted text here? And rather uneven line
lengths at that! (Hint: Here's _one_ reason why you should have posted a
URL: your (excuse for a) newsreader probably split your lines.)

Preformatted text is _bad_ for normal text.

Quoted text here. Click to load it

Surprisingly, IE is correct here.
"SGML (see [ISO8879], section 7.6.1) specifies that a line break immediately
following a start tag must be ignored, as must a line break immediately
before an end tag. This applies to all HTML elements without exception."

On the other hand, browsers are know to violate such rules, and if IE gets
this right, it probably gets it right by accident only. The safe way is to
avoid such linebreaks, writing

<tagname ...>text
more text
more text
last line</tagname>

My Firefox 2 correctly ignores those line breaks, so what does your document
really contain and which version of Firefox 2 are you using.

Naturally, things change (both in principle and on those browsers) if the
tag <td id="textarea"> is actually followed by a _space_ before the newline.

By the way, which doctype are you using? IE (both 6 and 7) ignores
white-space: pre in Quirks Mode. Hint: If you specify the URL when asking a
question, you won't have to wait for a few rounds of discussion just to make
your problem _analyzable_.

Jukka K. Korpela ("Yucca")

Site Timeline