文字围绕效果
# 两行省略结尾处展开/折叠效果

<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<title>Document</title>
<style>
p {
margin: 0;
padding: 0;
}
.text-wrap {
float: right;
width: 15px;
height: 15px;
shape-outside: content-box;
background-color: rebeccapurple;
border: 2px solid black;
border-radius: 2px;
margin-top: 20px;
padding-left: 5px;
/* padding: 20px; */
}
.ellipsis {
display: -webkit-box;
-webkit-line-clamp: 2; /* 显示的行数 */
-webkit-box-orient: vertical;
overflow: hidden;
text-overflow: ellipsis;
line-height: 20px;
}
.box {
width: 400px;
}
</style>
</head>
<body>
<div class="box ellipsis">
<div class="text-wrap"></div>
<p>
这是要环绕的文本内容。这是要环绕的文本内容。这是要环绕的文本内容。这是要环绕的文本内容。这是要环绕的文本内容。这是要环绕的文本内容。这是要环绕的文本内容。
</p>
</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
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
上次更新: 2024/05/08, 16:46:19