-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathtable溢出父元素.html
More file actions
94 lines (86 loc) · 1.9 KB
/
Copy pathtable溢出父元素.html
File metadata and controls
94 lines (86 loc) · 1.9 KB
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
90
91
92
93
94
<!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>
.ct {
display: flex;
width: 100%;
height: 300px;
}
.div1 {
width: 70%;
margin-right: 10px;
background-color: #1ab384;
display: flex;
}
.div2 {
width: 30%;
border: 1px solid #e43937;
}
.c1,
.c2 {
width: 50%;
height: 100%;
}
.c1 {
margin-right: 10px;
}
table {
width: 100%;
/* 表格会溢出父元素的宽度,导致内容跑出元素外, 使用下面方式解决 */
table-layout: fixed;
word-break: break-all;
}
td {
width: 10%;
}
</style>
</head>
<body>
<div class="ct">
<div class="div1">
<div class="c1"></div>
<div class="c2">
<table>
<tr>
<td>班级</td>
<td>人数</td>
<td>班主任</td>
<td>班级</td>
<td>人数</td>
<td>班主任</td>
</tr>
<tr>
<td>7-4</td>
<td>31</td>
<td>sellea</td>
<td>5-11</td>
<td>131</td>
<td>catalina</td>
</tr>
<tr>
<td>7-4</td>
<td>31</td>
<td>sellea</td>
<td>5-11</td>
<td>131</td>
<td>catalina</td>
</tr>
<tr>
<td>7-4</td>
<td>31</td>
<td>sellea</td>
<td>5-11</td>
<td>131</td>
<td>catalina</td>
</tr>
</table>
</div>
</div>
<div class="div2"></div>
</div>
</body>
</html>