强制描述Widget包装
问题描述:
我想在XUL应用程序中获取包装的描述,即使它包含长行。强制描述Widget包装
例如,如果我保存以下为.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>
但是,如果我删除空格在大线,就没有得到包裹,我只是得到一个滚动条查看线路:
<?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像素的限制被包裹?
答
的Firefox 3.1支持这样的:http://www.css3.info/preview/word-wrap/
的自动换行属性是由微软发明的,并添加到CSS3。它允许长词可以被分解并包装到下一行。它有两个值。正常或闯词。 目前支持IE,Safari和Firefox 3.1(Alpha)。
对于旧版本(当前版本)的Firefox,没有标准的方法(谷歌是我的朋友)这样做。有些人建议使用一个小的脚本,在词的中间添加<br />
。使用文字包装:打破字,并希望用户最终会升级。
答
本来ChatZilla用来分散空<IMG>元素注入其中,将作为在该长的话可以换点输出,虽然这后来改为<WBR>元素。