Html table td里使用overflow:hidden无效解决方法
来源:互联网 发布:urllib json 编辑:程序博客网 时间:2024/06/01 18:31
在表格里经常用到溢出隐藏,溢出省略,发现直接在td标签里使用overflow:hidden有时无效。
如果遇到这种情况,尝试两种方式可以解决:
解决方法一:在table里使用table-layout:fixed;
<table style="table-layout:fixed"> <td style="overflow:hidden"> </td> </table>
table-layout:fixed是什么鬼??百度翻译结果:表格布局:固定;
这是一个固定布局的算法,表格的宽度不是根据表格里的内容改变而改变的,display:inline-block,width规定了表格列的宽度。
PS: 溢出省略号css代码>overflow:hidden;text-overflow:ellipsis;white-space:nowrap; 然后固定容器宽度就可以啦。
text-overflow:ellipsis 属性的兼容性很好,尤其不用担心IE兼容问题(ie6+都可以),但火狐浏览器需要7.0+,加个-o-欧朋浏览器前缀就OK了,对于火狐低版本浏览器,需要用js截取方法(还有更好办法?)
解决方法二:在table的td中使用div 把内容放进去,固定宽度,做溢出处理。
0 0
- Html table td里使用overflow:hidden无效解决方法
- overflow hidden td
- overflow: hidden IE7无效
- overflow:hidden;text-overflow:ellipsis;在table的td中失效?
- table里td标签的width属性在ie浏览器中无效解决方法
- table里td标签的width属性在ie浏览器中无效解决方法
- table设置td文本超出为省略号无效的解决方法
- IE6下 Bug overflow:hidden无效解决办法
- ie7中overflow:hidden无效解决办法
- 在移动端设置overflow:hidden,无效?
- table td 中定义了 width 但 overflow 不起作用的解决方法
- css使table支持overflow:hidden;
- table的td如何设置overflow:scroll
- IE overflow:hidden失效的解决方法:
- IE下overflow:hidden失效的解决方法
- IE overflow:hidden失效的解决方法
- 【html&css】overflow :hidden详细解释
- Table中的td,th用了Colspan或者Rowspan之后,设置宽度无效的解决方法
- AOP (面向切面编程)
- Anfroid之Pull解析XML
- 【cocos2d-x 3.5】Lua常见UI的代码实现
- Windows Phone 应用栏
- 【Unity】CPU优化
- Html table td里使用overflow:hidden无效解决方法
- 白话Dubbo——Dubbo框架说明与当当网Duboox REST
- Shutting down interface eth1: Error: Device ‘eth1′ NetworkManager/Devices/1 disconnecting failed: Th
- Android 设计中的.9.png
- more指令的实现及文件操作函数
- 计算几何知识
- Android strings.xml中定义字符串显示空格
- Windows Phone 有背景的按钮
- Java Swing图形化用户界面编程