|
Posted by Jukka K. Korpela on 07/06/06 08:34
None <kentor@gmail.com> scripsit:
> in FF <pre width=100> whatever text </pre> works fine and wraps the
> text so that it won't go crazy and go all over the place but with IE
> it messes up and wont wrap the text...
No, IE gets it right and FF gets it wrong. The width attribute <pre>, though
defined in HTML specs, has usually been ignored by browsers, which is quite
acceptable - it is just a suggestion. It is meant to specify the length of
the longest line so that the browser can select a suitable font size, i.e.
automatically reduce font size to make the content fit into the browser
window, or perhaps reduce indentation that it otherwise uses for <pre>
elements. This was a poor idea*) and left unimplemented, but it _is_ the
defined meaning. It shall _not_ affect the rendering of the content as
regards to division into lines. Ref.:
http://www.w3.org/TR/html4/struct/text.html#h-9.3.4
*) A browser can _calculate_ the length of the longest line. It is awkward
to make _people_ count characters.
If you want text to wrap, why are you using the <pre> element, which by
definition means _preformatted_ text, i.e. text that has already been
divided into lines in a manner that shall be preserved in display? If you
have problems with wrapping in <pre>, the odds are that the real problem is
that you chose to use <pre>.
--
Jukka K. Korpela ("Yucca")
http://www.cs.tut.fi/~jkorpela/
Navigation:
[Reply to this message]
|