我正在尝试将文本包装在固定布局中,但当文本包含斜杠时它不起作用。
可以在不从 Javascript(纯 CSS)插入空格的情况下解决这个问题吗?
jsfiddle:
Not working:
<div style="display:table; width:170px; background-color:cyan;">
<div style="display:table-row">
<div style="display:table-cell;word-wrap: break-word;">abfdbfdbfdb/dfbfdbdfbfbf/bdffbdbfdfbddfbdfbdfb</div>
<div style="display:table-cell; width:34px; background-color:red;">xxxxx</div>
</div>
</div>
</br>
Working:
<div style="display:table; width:170px; background-color:cyan;">
<div style="display:table-row">
<div style="display:table-cell;word-wrap: break-word;">abfdbfdbfdb dfbfdbdfbfbf bdffbdbfdfbddfbdfbdfb</div>
<div style="display:table-cell; width:34px; background-color:red;">xxxxx</div>
</div>
</div>