CSS实现自动换行
|
源代码网整理以下大家都知道连续的英文或数字能是容器被撑大,不能根据容器的大小自动换行,下面是 CSS如何将他们换行的方法! 源代码网整理以下对于div 源代码网整理以下1、(IE浏览器)white-space:normal; word-break:break-all;这里前者是遵循标准。 源代码网整理以下#wrap{white-space:normal; width:200px; } 源代码网整理以下或者 源代码网整理以下#wrap{word-break:break-all;width:200px;} 源代码网整理以下<div >ddd1111111111111111111111111111111111</div> 源代码网整理以下效果:可以实现换行 源代码网整理以下2、(Firefox浏览器)white-space:normal; word-break:break-all;overflow:hidden;同样的FF下也没有很好的实现方法,只能隐藏或者加滚动条,当然不加滚动条效果更好! 源代码网整理以下#wrap{white-space:normal; width:200px; overflow:auto;} 源代码网整理以下或者 源代码网整理以下#wrap{word-break:break-all;width:200px; overflow:auto; } 源代码网整理以下<div >ddd1111111111111111111111111111111111111111</div> 源代码网整理以下效果:容器正常,内容隐藏 源代码网整理以下对于table 源代码网整理以下1、(IE浏览器)使用样式table-layout:fixed; 源代码网整理以下
源代码网整理以下效果:可以换行 源代码网整理以下2、(IE浏览器)使用样式table-layout:fixed与nowrap 源代码网整理以下
源代码网整理以下效果:可以换行 源代码网整理以下3、(IE浏览器)在使用百分比固定td大小情况下使用样式table-layout:fixed与nowrap 源代码网整理以下
源代码网整理以下效果:两个td均正常换行 源代码网整理以下4、(Firefox浏览器)在使用百分比固定td大小情况下使用样式table-layout:fixed与nowrap,并且使用div 源代码网整理以下
源代码网整理以下这里单元格宽度一定要用百分比定义 源代码网整理以下效果:正常显示,但不能换行(注:在FF下还没有能使容器内容换行的好方法,只能用overflow将多出的内容隐藏,以免影响整体效果) 源代码网供稿. |
