【发布时间】:2011-04-22 03:38:20
【问题描述】:
我有一个 XML 文件,我试图仅通过添加 CSS 来显示它。
XML 有许多如下所示的元素:
<text>
this is some text.
Yeah, some text.
</text>
<text>
This is some text. This is some text. This is some text. This is some text. This is some text. This is some text. This is some text. This is some text. This is some text. This is some text. This is some text. This is some text. This is some text. This is some text. This is some text. This is some text. This is some text. This is some text. This is some text. This is some text. This is some text. This is some text. This is some text. This is some text. This is some text. This is some text. This is some text. This is some text. This is some text. This is some text. This is some text.
</text>
我希望 CSS 保留换行符但自动换行。
如果我的 CSS 看起来像这样:
text {
white-space: pre;
}
我得到了空白行,但文本超出了右边距。
如果我的 CSS 看起来像这样:
text {
width: 500px;
}
我得到了我的包装,但丢失了我的空白行。
有什么办法可以两者兼得?
【问题讨论】: