2009-01-07 78 views
2

我想在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像素的限制被包裹?

回答

2

的Firefox 3.1支持這樣的:http://www.css3.info/preview/word-wrap/

的自動換行屬性是由微軟發明的,並添加到CSS3。它允許長詞可以被分解幷包裝到下一行。它有兩個值。正常或闖詞。 目前支持IE,Safari和Firefox 3.1(Alpha)。

對於舊版本(當前版本)的Firefox,沒有標準的方法(谷歌是我的朋友)這樣做。有些人建議使用一個小的腳本,在詞的中間添加<br />。使用文字包裝:打破字,並希望用戶最終會升級。

0

本來ChatZilla用來分散空<IMG>元素注入其中,將作爲在該長的話可以換點輸出,雖然這後來改爲<WBR>元素。