0%

JQUERY树形关系1-CSS样式

导入的css样式:

1
<link href=”https://cdn.bootcss.com/font-awesome/5.8.1/css/all.css” rel=”stylesheet”>

使用的css样式

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
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
<style>
ul,
li {
list-style-type: none;
}

.tree {
width: 100%;
min-height: 100%;
overflow: scroll;
display: block;
position: relative;
padding: 5px 15px;
}

.tree p {
margin: 3px 0;
text-align: left;
}

.tree i {
font-style: normal;
}

.tree .i_box {
height: 28px;
text-align: right;
}

.tree span {
display: inline-block;
box-sizing: border-box;
line-height: 28px;
min-width: 60px;
text-align: center;
color: #888;
border: 1px solid #ddd;
border-radius: 5px;
padding: 0 8px;
}

.tree ul {
position: relative;
padding-left: 60px;
margin: 0;
}

.tree ul>li {
position: relative;
padding: 5px 0;
}

.tree>ul {
padding: 0;
margin: 0;
}
/** 水平方向连线 */

.tree>ul ul>li:after {
content: ‘ ‘;
position: absolute;
top: 20px;
left: -45px;
width: 45px;
border: none;
border-top: 1px solid #ddd;
}
/** 垂直方向连线 */

.tree ul>li:not(:last-child):before {
content: ‘ ‘;
position: absolute;
top: 0;
left: -45px;
height: 100%;
border: none;
border-left: 1px solid #ddd;
}

.tree ul>li:last-child:before {
content: ‘ ‘;
position: absolute;
top: 0;
left: -45px;
height: 20px;
border: none;
border-left: 1px solid #ddd;
}
/** 控制鼠标移上去的颜色 */

.tree span:hover,
.tree span:hover+ul span {
color: #fff;
background-color: orange;
}

.tree span:hover,
.tree span:hover+ul span,
.tree span:hover+ul li:before,
.tree span:hover+ul li:after {
border-color: orange;
}
/** 折叠图标 */

.tree .fa:before {
margin-right: 5px;
}

.tree .fa-minus-circle,
.tree .fa-plus-circle {
cursor: pointer;
}
</style>