亚洲在线久爱草,狠狠天天香蕉网,天天搞日日干久草,伊人亚洲日本欧美

為了賬號安全,請及時綁定郵箱和手機立即綁定
已解決430363個問題,去搜搜看,總會有你想問的

HTML表中的單詞包裝

HTML表中的單詞包裝

慕的地6264312 2019-06-25 13:09:14
HTML表中的單詞包裝我一直在用word-wrap: break-word將文本包裝在divS和span然而,它似乎在表單元格中不起作用。我有一張桌子width:100%,有一行和兩列。列中的文本,盡管采用上述樣式word-wrap不包。它會導致文本超出單元格的界限。這種情況發生在Firefox、GoogleChrome和InternetExplorer上。來源如下:td {  border: 1px solid;}<table style="width: 100%;">  <tr>    <td>      <div style="word-wrap: break-word;">        Looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong word      </div>    </td>    <td><span style="display: inline;">Short word</span></td>  </tr></table>上面的長單詞比我的頁面的邊界要大,但它不會與上面的HTML斷絕關系。我已經嘗試了以下添加的建議text-wrap:suppress和text-wrap:normal但兩者都不起作用。
查看完整描述

3 回答

?
紅顏莎娜

TA貢獻1842條經驗 獲得超13個贊

以下內容在InternetExplorer中適用于我。注意添加了table-layout:fixedCSS屬性


td {

  border: 1px solid;

}

<table style="table-layout: fixed; width: 100%">

  <tr>

    <td style="word-wrap: break-word">

      LongLongLongLongLongLongLongLongLongLongLongLongLongLongLongLongLongLongLongLongLongLongLongLongLongLongLongLongLongLongLongLongLongLongLongLongLongLongLongLongWord

    </td>

  </tr>

</table>


查看完整回答
反對 回復 2019-06-25
?
波斯汪

TA貢獻1811條經驗 獲得超4個贊

<td style="word-break:break-all;">longtextwithoutspace</td>

<span style="word-break:break-all;">longtextwithoutspace</span>


查看完整回答
反對 回復 2019-06-25
?
精慕HU

TA貢獻1845條經驗 獲得超8個贊

很長的機會,但要反復檢查火蟲(或類似的)您不會意外繼承以下規則:

white-space:nowrap;

這可能會覆蓋指定的斷行為。


查看完整回答
反對 回復 2019-06-25
  • 3 回答
  • 0 關注
  • 347 瀏覽
慕課專欄
更多

添加回答

舉報

0/150
提交
取消
微信客服

購課補貼
聯系客服咨詢優惠詳情

幫助反饋 APP下載

慕課網APP
您的移動學習伙伴

公眾號

掃描二維碼
關注慕課網微信公眾號