CSS 跨浏览器隐藏文字
时间:2010-09-13 来源:rubyz
在页面里使用 inline-block 元素时经常需要隐藏其文字,目前比较常见的方法是将 line-height 的值设置得很大,然后配合 overflow: hidden 来隐藏文字。
我认为过大的行高会影响渲染效率,而行高不够又可能在用户对页面进行放大操作时露出“马脚”(即未能被隐藏的部分)。
是否当 line- // for firefox & opera
color: transparent; // for webkit
line-height:0;
overflow:hidden; // for IE
复制代码
测试后兼容的浏览器如下:
IE 6-8 OK
Firefox 1-4 OK
Opera 9-10 OK
Safari 3-5 OK
Chrome 1-6 OK
我认为过大的行高会影响渲染效率,而行高不够又可能在用户对页面进行放大操作时露出“马脚”(即未能被隐藏的部分)。
是否当 line- // for firefox & opera
IE 6-8 OK
Firefox 1-4 OK
Opera 9-10 OK
Safari 3-5 OK
Chrome 1-6 OK
相关阅读 更多 +