Html 页面的强制换行问题总结

2020-05-15 08:11:40易采站长站整理

</td>

</tr>

</table>
效果:
改成百分比,终于搞定了

例6:(Firefox浏览器)在使用百分比固定td大小情况下使用样式table-layout:fixed和nowrap效果:
把例5放到firefox下面,又ft了

例7:(Firefox浏览器)在使用百分比固定td大小情况下使用样式table-layout:fixed和nowrap,并且使用div

<style>

.tbl {table-layout:fixed}

.td {overflow:hidden;}

</style>

<table class=tbl border=1 width=80>

<tr>

<td width=25% class=td nowrap>

<div>abcdefghigklmnopqrstuvwxyz 1234567890</div>

</td>

<td class=td nowrap>

<div>abcdefghigklmnopqrstuvwxyz 1234567890</div>

</td>

</tr>

</table>


效果:
天下终于太平了

例8:(Firefox浏览器)在使用数值固定td大小情况下使用样式table-layout:fixed和nowrap,并且使用div

<style>

.tbl {table-layout:fixed}

.td {overflow:hidden;}

</style>

<table class=tbl border=1 width=80>

<tr>

<td width=20 class=td nowrap>

<div>abcdefghigklmnopqrstuvwxyz 1234567890</div>

</td>

<td class=td nowrap>

<div>abcdefghigklmnopqrstuvwxyz 1234567890</div>

</td>

</tr>

</table>


效果:
nowrap又不起作用了

最终,例7是个在IE和Firefox都能完美解决页面强制换行问题的解决方案。