pre标签自动换行方案
December 3, 2006
pre标签会原样保留HTML内容的格式,可是如果宽度过大会把页面撑坏,这时候需要自动换行来帮忙:
Wrapping the pre tag
Making preformated text wrap in CSS3, Mozilla, Opera and IEis the tip that let’s you use the pre tag to keep the formatting, without cursing yourself when some of the content is too long and doesn’t wrap:
/* Browser specific (not valid) styles to make preformatted text wrap /
pre {
white-space: pre-wrap; / css-3 /
white-space: -moz-pre-wrap; / Mozilla, since 1999 /
white-space: -pre-wrap; / Opera 4-6 /
white-space: -o-pre-wrap; / Opera 7 /
word-wrap: break-word; / Internet Explorer 5.5+ */
}



不行.
在IE及table tr td 下无效,在div下是可以的.
有table下解决方案吗?
to coocboy:给td的width设上值试试。我这是可以的(FF2,IE7)。
有设置width=”100%”,也就是设置百分比是不会换行的,
但固定宽度我又用不上,只能让程序屏蔽pre这个办法好点.