簡體   English   中英

word-wrap:break-word 在 IE8 中沒有按預期工作

[英]word-wrap:break-word not working as expected in IE8

我跟着這個

也就是說,要使用 word-wrap:break-word,我們需要為 table 元素設置“table-layout:fixed”。 即使這樣,它也不能在 IE8 中工作。 我在這里缺少任何基礎知識嗎?

我在 IE8 和 IE6 中附加了它的屏幕截圖。 以及如何在 IE8 中呈現 HTML。 (IE8中包含表格的面板有滾動條。)

IE6

IE8

IE8

從渲染的 HTML 中,我發現 Table Layout 是 Fixed 並且樣式也被應用了。

但即便如此,IE8 以不同的方式顯示網格。

<table cellspacing="0" rules="all" border="0" id="ctl00_memberContentPlaceHolder_empiMemberHcidGridView" style="border-width:0px;border-style:None;height:150px;width:750px;border-collapse:collapse;**table-layout: fixed**">
            <tr class="Row" align="center">
                <td align="left" style="width:155px;white-space:nowrap;">
                                        <span id="ctl00_memberContentPlaceHolder_empiMemberHcidGridView_ctl02_typeLabel">IT</span>
                                    </td><td align="left" style="width:155px;white-space:nowrap;">
                                        <span id="ctl00_memberContentPlaceHolder_empiMemberHcidGridView_ctl02_firstNameLabel">AAA</span>
                                    </td><td align="left" style="width:155px;white-space:nowrap;">
                                        <span id="ctl00_memberContentPlaceHolder_empiMemberHcidGridView_ctl02_lastNameLabel">BBB</span>
                                    </td><td align="left" style="width:155px;white-space:nowrap;">
                                        <span id="ctl00_memberContentPlaceHolder_empiMemberHcidGridView_ctl02_appReceivedDateLabel">3/01/2011</span>
                                    </td><td align="left" style="width:155px;white-space:nowrap;**WORD-BREAK:BREAK-ALL**">
                                        <span id="ctl00_memberContentPlaceHolder_empiMemberHcidGridView_ctl02_commentsLabel">TestingTestingTestingTestingTestingTestingTestingTestingTestingTestingTestingTesting</span>
                                    </td>
        </table>

有什么幫助嗎? 提前致謝

實際上,我不會擔心您的示例中看到的這種人為文本的自動換行(沒有空格)。

也就是說,解決方案之一可能是將內容包裝在 div 中並將寬度和自動換行應用於 div。 例如看這個小提琴: http://jsfiddle.net/6Cm3U/1/

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM