强制描述小部件换行
我试图在 XUL 应用程序中获取描述来换行,即使它包含长行。
例如,如果我将以下内容保存为 .xul 文件并在 Firefox 中打开它,它看起来很好并且适当地换行:
<?xml version="1.0"?>
<?xml-stylesheet href="chrome://global/skin/" type="text/css"?>
<window
id="theWindow"
title="The Window"
style="overflow: auto;"
xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul"
xmlns:html="http://www.w3.org/1999/xhtml"
>
<vbox flex="1" style="max-width: 200px; overflow:auto; border: 1px dotted black; padding: 2px;">
<description style="border: 1px solid black; padding: 2px;">test</description>
<description style="border: 1px solid black; padding: 2px;">test test test test test test test test test test test test test test test test test test test test test</description>
</vbox>
</window>
但是,如果我删除大行中的空格,它不会被换行,我只是得到一个滚动条bar 查看行:
<?xml version="1.0"?>
<?xml-stylesheet href="chrome://global/skin/" type="text/css"?>
<window
id="theWindow"
title="The Window"
style="overflow: auto;"
xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul"
xmlns:html="http://www.w3.org/1999/xhtml"
>
<vbox flex="1" style="max-width: 200px; overflow:auto; border: 1px dotted black; padding: 2px;">
<description style="border: 1px solid black; padding: 2px;">test</description>
<description style="border: 1px solid black; padding: 2px;">testtesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttest</description>
</vbox>
</window>
有什么方法可以使用 CSS 或其他任何方法来强制长行在达到 200 像素限制时换行吗?
I am trying to get a description in a XUL application to wrap, even if it contains long lines.
For example, if I save the following as a .xul file and open it in Firefox, it looks fine and wraps appropriately:
<?xml version="1.0"?>
<?xml-stylesheet href="chrome://global/skin/" type="text/css"?>
<window
id="theWindow"
title="The Window"
style="overflow: auto;"
xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul"
xmlns:html="http://www.w3.org/1999/xhtml"
>
<vbox flex="1" style="max-width: 200px; overflow:auto; border: 1px dotted black; padding: 2px;">
<description style="border: 1px solid black; padding: 2px;">test</description>
<description style="border: 1px solid black; padding: 2px;">test test test test test test test test test test test test test test test test test test test test test</description>
</vbox>
</window>
However, if I remove the spaces in the big line, it doesn't get wrapped and I just get a scroll bar to see the line:
<?xml version="1.0"?>
<?xml-stylesheet href="chrome://global/skin/" type="text/css"?>
<window
id="theWindow"
title="The Window"
style="overflow: auto;"
xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul"
xmlns:html="http://www.w3.org/1999/xhtml"
>
<vbox flex="1" style="max-width: 200px; overflow:auto; border: 1px dotted black; padding: 2px;">
<description style="border: 1px solid black; padding: 2px;">test</description>
<description style="border: 1px solid black; padding: 2px;">testtesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttest</description>
</vbox>
</window>
Is there any way I can use CSS or anything else to force the long line to be wrapped when it reaches the 200 pixel limit?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
Firefox 3.1 支持此: http://www.css3.info/preview/word-wrap/
对于较旧(和当前)版本的 Firefox,没有标准的方法(Google 是我的朋友)。 有些人建议使用一个小脚本,在单词中间添加
。 使用word-wrap:break-word并希望用户最终升级。Firefox 3.1 supports this: http://www.css3.info/preview/word-wrap/
With older (and current) versions of Firefox there is no standard way (Google was my friend) of doing it. Some suggest using a small script that adds
<br />
in the middle of the word. Use word-wrap:break-word and hope that users will eventually upgrade.最初 ChatZilla 用来散布空的 。 元素添加到输出中,这些元素将作为长单词可以换行的点,尽管后来更改为 元素。
Originally ChatZilla used to scatter empty <img> elements into the output which would serve as points at which long words could wrap, although this was later changed to <wbr> elements.