Sent by Jukka K. Korpela on 29 March 2008 17:05
Ian Young wrote:
> Been looking at the white-space rule and came across this on client's
> site.
> pre{
> white-space: pre; /* CSS2 */
> white-space: pre-wrap; /* CSS 2.1 */
> white-space: pre-line; /* CSS 3 */}
The comments are misleading, because pre-line is in CSS 2.1, too. And
the comments are rather pointless, since browsers don't play by "CSS
versions".
Apparently the idea is to set white-space so the pre-line is used, when
supported by a browser, otherwise pre-wrap, with pre as the ultimate
fallback.
There's not much point in setting white-space: pre for the pre element,
since it's the default for it in practice. Moreover, pre-wrap and
pre-line are different and generally a browser probably supports either
both of them or neither of them, so where's the point?
> What is best usage?
It depends on how pre elements should be rendered. This depends on their
content and purpose.
Fundamentally, pre means 'preformatted text', so what would be the idea
in setting other that white-space: pre for it? There _might_ be a
reason, but this really deopends. If you consider setting it to pre-wrap
and pre-line, check the CSS 2.1 draft for their exact meanings, and
beware that browser support is limited.
Jukka K. Korpela ("Yucca")
http://www.cs.tut.fi/~jkorpela/
______________________________________________________________________
css-discuss [EMAIL-REMOVED]]
http://www.css-discuss.org/mailman/listinfo/css-d
List wiki/FAQ -- http://css-discuss.incutio.com/
List policies -- http://css-discuss.org/policies.html
Supported by evolt.org -- http://www.evolt.org/help_support_evolt/