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

Your name:

Reply:


Posted by Jukka K. Korpela on 05/30/07 09:06

Scripsit noagbodjivictor@gmail.com:

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

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.)

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

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.

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

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."
http://www.w3.org/TR/html401/appendix/notes.html#h-B.3.1

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")
http://www.cs.tut.fi/~jkorpela/

[Back to original message]


Удаленная работа для программистов  •  Как заработать на Google AdSense  •  England, UK  •  статьи на английском  •  PHP MySQL CMS Apache Oscommerce  •  Online Business Knowledge Base  •  DVD MP3 AVI MP4 players codecs conversion help
Home  •  Search  •  Site Map  •  Set as Homepage  •  Add to Favourites

Copyright © 2005-2006 Powered by Custom PHP Programming

Сайт изготовлен в Студии Валентина Петручека
изготовление и поддержка веб-сайтов, разработка программного обеспечения, поисковая оптимизация