84669 person learning
152542 person learning
20005 person learning
5487 person learning
7821 person learning
359900 person learning
3350 person learning
180660 person learning
48569 person learning
18603 person learning
40936 person learning
1549 person learning
1183 person learning
32909 person learning
As in the title, the width is fixed, if the number of words exceeds the number, use... instead
光阴似箭催人老,日月如移越少年。
overflow:hidden;white-space:nowrap;text-overflow:ellipsis; overflow:hidden:超出隐藏 white-space:nowrap:强制不换行 text-overflow:ellipsis:超出省略号代替;
Portal, go check it out
Fixed approach requires the following four conditions: 1. Fixed width 2.overflow:hidden3.white-space:nowrap4.text-overflow:ellipsis
display: -webkit-box; box-orient: vertical; line-clamp: 3; // 可控制几行后有 ... -webkit-box-orient: vertical; -webkit-line-clamp: 3; // 兼容写法 overflow: hidden; white-space:normal;
First of all, the first point is that the line needs to be given a fixed width. Even if the width is not given, the line needs to be limited by margin. To put it bluntly, it is to give the line a fixed width. . . Other codes are as follows
如果是一个p标签 p{ width:100px;//固定宽度 overflow:hidden;//超出隐藏 white-space:nowrap;//不换行 text-overflow:ellipsis;//省略号 }
/a/11...Two implementation methods, fixed width, excess display..., mouse hover to omit content
// line-clamp、line-height和height直接控制多行 .two-line { color: #333; line-height: 18px; height: 36px; overflow : hidden; text-overflow: ellipsis; display: -webkit-box; display: -moz-box; -webkit-line-clamp: 2; -moz-line-clamp: 2; line-clamp: 2; -webkit-box-orient: vertical; -moz-box-orient: vertical; box-orient: vertical; }
With fixed width, use overflow:hidden;text-overflow:ellipsis;white-space:nowrap;
Portal, go check it out
Fixed approach requires the following four conditions:
1. Fixed width
2.overflow:hidden
3.white-space:nowrap
4.text-overflow:ellipsis
First of all, the first point is that the line needs to be given a fixed width. Even if the width is not given, the line needs to be limited by margin. To put it bluntly, it is to give the line a fixed width. . .
Other codes are as follows
/a/11...
Two implementation methods, fixed width, excess display..., mouse hover to omit content
With fixed width, use overflow:hidden;text-overflow:ellipsis;white-space:nowrap;