本文摘自PHP中文网,作者醉折花枝作酒筹,侵删。
方法:首先使用“word-break:keep-all”语句设置不换行;然后使用“overflow:hidden”语句设置超出隐藏部分;最后使用“text-overflow:ellipsis”语句设置溢出显示省略号。

本教程操作环境:windows7系统、CSS3&&HTML5版、Dell G3电脑。
td溢出隐藏
1 2 3 4 5 6 7 8 9 10 11 | table{
width:100px;
table-layout:fixed;
}
td{
width:100%;
word- break :keep-all;
white-space:nowrap;
overflow:hidden;
text-overflow:ellipsis;
}
|
全部代码:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 | <!DOCTYPE html>
<html>
<head>
<meta http-equiv= "Content-Type" content= "text/html; charset=utf-8" />
<title>document</title>
<style>
table{
width:100px;
table-layout:fixed;
}
td{
width:100%;
word- break :keep-all;
overflow:hidden;
text-overflow:ellipsis;
}
</style>
</head>
<body>
<table border= "1" >
<tr>
<td>19999</td>
<td>19999</td>
</tr>
<tr>
<td>19999</td>
<td>19999</td>
</tr>
<tr>
<td>19999</td>
<td>19999</td>
</tr>
</table>
</body>
</html>
|
效果截图:
阅读剩余部分
相关阅读 >>
css怎么设置文本颜色
css text-decoration-style属性怎么用
用css制作立体导航栏的方法
css文件怎么解压缩
css怎么设置网页标题栏图标
css的用法有哪些
css中文乱码怎么办
css如何设置字体平滑
css怎么设置颜色渐变
css横向滚动条怎么隐藏
更多相关阅读请进入《css》频道 >>
人民邮电出版社
本书对 Vue.js 3 技术细节的分析非常可靠,对于需要深入理解 Vue.js 3 的用户会有很大的帮助。——尤雨溪,Vue.js作者
转载请注明出处:木庄网络博客 » css如何设置td溢出隐藏