Dan Jacobson <ji*****@jidanni.org> wrote:
In wdg-html-reference/html40/block/pre.html
You presumably mean
http://www.htmlhelp.com/reference/html40/block/pre.html
there is no mention about
how ASCII tabs (^I) are to be rendered. I suppose all bets are off?
If you check the specification (using e.g. links at the bottom of that
page), you will see that there is a definition on how tabs should be
dealt with in <pre> content _and_ a remark that you should not rely on
that since browser behavior varies. Well, the HTML 4 wording has
actually even removed the _definition_ and replaced it with a
_description_:
"The horizontal tab character (decimal 9 in [ISO10646] and [ISO88591] )
is usually interpreted by visual user agents as the smallest non-zero
number of spaces necessary to line characters up along tab stops that
are every 8 characters. We strongly discourage using horizontal tabs in
preformatted text since it is common practice, when editing, to set the
tab-spacing to other values, leading to misaligned documents."
Source: http://www.w3.org/TR/html4/struct/text.html#edef-PRE
Wait, my docs go thru html-tidy first, and it says
tab-size: number
Sets the number of columns between successive tab stops. The
default is 4. It is used to map tabs to spaces when reading
files. Tidy never outputs files with tabs.
That's rather illogical, though understandable (since in many contexts
outside HTML, such tab stop settings are common). It means that a valid
HTML document (the use of tabs is valid, though not recommended) will
be converted to a document with a different meaning as per the old
specifications, since in <pre> content the amount of white space is
significant.
But why would this matter, in HTML authoring for the WWW? If your data
is tabular, you should probably not use <pre> at all but <table>.
And if you have existing data with tabs, and for some reason you are
not going to convert it to table format, then you should run a
conversion that replaces tabs by spaces _as adequate for the data_.
--
Yucca,
http://www.cs.tut.fi/~jkorpela/
Pages about Web authoring:
http://www.cs.tut.fi/~jkorpela/www.html