.relationship {
padding:20px;
}
.relationship *,.relationship *:before,.relationship *:after {
-webkit-box-sizing:border-box;
-moz-box-sizing:border-box;
box-sizing:border-box;
}
.relationship table {
border-spacing:0;
border-collapse:separate;
}
.relationship>table:first-child {
margin:20px auto;
}
.relationship td {
text-align:center;
vertical-align:top;
padding:0;
}
.relationship td.top {
border-top:2px solid rgba(217,79,213,0.8);
}
.relationship td.right {
border-right:1px solid rgba(217,79,213,0.8);
float:none;
}
.relationship td.left {
border-left:1px solid rgba(217,79,213,0.8);
float:none;
}
.relationship td>.down {
background-color:rgba(217,79,213,0.8);
margin:0px auto;
height:20px;
width:2px;
float:none;
}
.relationship .node {
display:inline-block;
position:relative;
margin:0;
padding:3px;
border:2px dashed transparent;
text-align:center;
width:130px;
}
.relationship .node:hover {
background-color:rgba(79,147,217,0.8);
transition:.5s;
cursor:default;
z-index:20;
}
.relationship .node .title {
text-align:center;
font-size:12px;
font-weight:bold;
height:20px;
line-height:20px;
overflow:hidden;
text-overflow:ellipsis;
white-space:nowrap;
background-color:rgba(217,79,213,0.8);
color:#fff;
border-radius:4px 4px 0 0;
}
.relationship .node .title .symbol {
float:left;
margin-top:4px;
margin-left:2px;
}
.relationship .node .content {
width:100%;
height:20px;
font-size:11px;
line-height:18px;
border:1px solid rgba(217,79,213,0.8);
border-radius:0 0 4px 4px;
text-align:center;
background-color:#fff;
color:#333;
overflow:hidden;
text-overflow:ellipsis;
white-space:nowrap;
}
代码里面有写注释,很简单,可以根据传入的数据动态加载布局,只需要把样式和代码复制到你的项目里面,把数据换成后台的json数据就可以了,简单明了,有什么问题可以提出来,一起讨论一下