我不是HTML / CSS专家。我需要创建一个蝴蝶结图并找到以下内容。但是,我需要“镜像”它,以便我左边的条目进入根,然后我已经拥有的是右边的条目源于根。也就是说,根需要分支到左右两侧。
或者,我可以采用一个家谱,将节点放在中间,并且盒子向上和向下都有。任何帮助将不胜感激!
HTML& CSS:
*,
*:before,
*:after {
-webkit-box-sizing: border-box;
-moz-box-sizing: border-box;
box-sizing: border-box;
}
body {
min-width: 1200px;
margin: 0;
padding: 50px;
color: #000;
;
font: 16px Verdana, sans-serif;
-webkit-user-select: none;
-moz-user-select: none;
-ms-user-select: none;
user-select: none;
}
#wrapper {
position: absolute;
margin-left: 550px;
}
.branch {
position: relative;
margin-left: 250px;
}
.branch:before {
content: "";
width: 50px;
border-top: 2px solid #000;
;
position: absolute;
left: -100px;
top: 50%;
margin-top: 1px;
}
.entry {
position: relative;
min-height: 60px;
}
.entry:before {
content: "";
height: 100%;
border-left: 2px solid #000;
;
position: absolute;
left: -50px;
}
.entry:after {
content: "";
width: 50px;
border-top: 2px solid #000;
;
position: absolute;
left: -50px;
top: 50%;
margin-top: 1px;
}
.entry:first-child:before {
width: 10px;
height: 50%;
top: 50%;
margin-top: 2px;
border-radius: 10px 0 0 0;
}
.entry:first-child:after {
height: 10px;
border-radius: 10px 0 0 0;
}
.entry:last-child:before {
width: 10px;
height: 50%;
border-radius: 0 0 0 10px;
}
.entry:last-child:after {
height: 10px;
border-top: none;
border-bottom: 2px solid #000;
;
border-radius: 0 0 0 10px;
margin-top: -9px;
}
.entry.sole:before {
display: none;
}
.entry.sole:after {
width: 50px;
height: 0;
margin-top: 1px;
border-radius: 0;
}
.label {
display: block;
min-width: 150px;
padding: 5px 10px;
line-height: 20px;
text-align: center;
border: 2px solid #000;
border-radius: 5px;
position: absolute;
left: 0;
top: 50%;
margin-top: -15px;
}
<div id="wrapper"><span class="label">Root</span>
<div class="branch lv1">
<div class="entry"><span class="label">Entry-1</span>
<div class="branch lv2">
<div class="entry"><span class="label">Entry-1-1</span>
</div>
<div class="entry"><span class="label">Entry-1-2</span>
</div>
<div class="entry"><span class="label">Entry-1-3</span>
</div>
</div>
</div>
<div class="entry"><span class="label">Entry-2</span>
</div>
<div class="entry"><span class="label">Entry-3</span>
<div class="branch lv2">
<div class="entry"><span class="label">Entry-3-1</span>
</div>
<div class="entry"><span class="label">Entry-3-2</span>
</div>
<div class="entry"><span class="label">Entry-3-3</span>
</div>
<div class="entry"><span class="label">Entry-3-4</span>
</div>
</div>
</div>
<div class="entry"><span class="label">Entry-4</span>
</div>
<div class="entry"><span class="label">Entry-5</span>
</div>
</div>
</div>