.parent {
position: relative;
}
.parent .parent-header:after {
content: '';
position: absolute;
width: 1px;
height: 30px;
left: 15px;
top: 36px;
border-left: 1px dotted black;
}
.child {
padding-left: 30px;
position: relative;
}
.child .child-header:before {
content: '';
position: absolute;
width: 1px;
height: 100%;
left: 15px;
top: 0px;
border-left: 1px dotted black;
}
.child:last-child .child-header:before {
content: none;
}
.child .child-header:after {
content: '';
height: 1px;
width: 15px;
position: absolute;
left: 15px;
top: 15px;
border-top: 1px dotted black;
}
<div class="parent">
<h2 class="parent-header">Heading</h2>
<div class="child">
<h2 class="child-header">Block 1</h2>
<div>some text some text some text some text some text some text some text some text some text some text some text some tex</div>
</div>
<div class="child">
<h2 class="child-header">Block 2</h2>
<div>some text some text some text some text some text some text some text some text some text some text some text some tex</div>
</div>
<div class="child">
<h2 class="child-header">Block 3</h2>
<div>some text some text some text some text some text some text some text some text some text some text some text some tex</div>
</div>
</div>
http://plnkr.co/edit/LmA1wsn8pLPwQCtPnqtM?p=preview
请查看plnkr。我试图填补垂直线之间的差距。有人能帮我吗。我对比实现这种造型更好的方式持开放态度
答案 0 :(得分:1)
http://plnkr.co/edit/H7LTMEBRlOpm89nCMCl6?p=preview
这里有你需要的东西。
.parent .parent-header:after {
top: 35px;
}
.child-header {
margin-top:0;
padding-top:25px;
}
.child:last-child .child-header:before {
height: 35px;
}
基本上造成这种差距的是来自h2.child-header的边距。因此,您需要更改它以进行填充,然后只需修改.child-header:在最高值之后即可。
希望我能够帮助你。
答案 1 :(得分:0)
在你的风格中添加元素默认填充和边距0。
*{
margin: 0;
padding : 0;
}
当您检查代码时,可以看到元素示例h2的默认样式
h2 {
display: block;
font-size: 1.5em;
-webkit-margin-before: 0.83em;
-webkit-margin-after: 0.83em;
-webkit-margin-start: 0px;
-webkit-margin-end: 0px;
font-weight: bold;
}