省略号后跟详情/展开
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8" />
<style>
* {
box-sizing: content-box;
}
.content {
position: relative;
border: 1px solid red;
width: 500px;
display: -webkit-box;
-webkit-box-orient: vertical;
-webkit-line-clamp: 2;
overflow: hidden;
line-height: 24px;
animation: widthanimate 5s ease 0s infinite;
}
@keyframes widthanimate {
0% {
width: 500px;
}
50% {
width: 800px;
}
100% {
width: 500px;
}
}
.clamp::before {
content: "";
float: right;
width: 1px;
height: 24px;
background-color: white;
}
.clamp::after {
content: "";
height: 20px;
background-color: white;
width: 100%;
position: absolute;
}
.first {
/* width: 100px; */
color: red;
float: right;
clear: both;
text-align: center;
}
.left{
float: left;
height: 20px;
}
</style>
</head>
<body>
<div id="el">
<div class="content">
<div class="clamp">
<span class="first"> 详情 </span>
<span>肺片毛玻璃</span>
<span>肺片毛玻璃</span>
<span>肺片毛玻璃</span>
<span>肺片毛玻璃</span>
<span>肺片毛玻璃</span>
<span>肺片毛玻璃</span>
<span>肺片毛玻璃</span>
<span>肺片毛玻璃</span>
<span>肺片毛玻璃</span>
<span>肺片毛玻璃</span>
<span>肺片毛玻璃</span>
<span>肺片毛玻璃</span>
<span>肺片毛玻璃</span>
</div>
</div>
</div>
</body>
</html>
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
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
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
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89