Reputation: 4951
.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
please look into the plnkr. i am trying to fill the gap between the vertical lines. can someone help me. I am open to better ways than what i did to achieve that styling
Upvotes: 0
Views: 3242
Reputation: 1007
add element default padding and margin 0 in you style.
*{
margin: 0;
padding : 0;
}
when you inspect your code can see default style for the element example 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;
}
code here : https://jsfiddle.net/okvnxqxo/
Upvotes: 0
Reputation: 2301
http://plnkr.co/edit/H7LTMEBRlOpm89nCMCl6?p=preview
here is the plunker what you need.
.parent .parent-header:after {
top: 35px;
}
.child-header {
margin-top:0;
padding-top:25px;
}
.child:last-child .child-header:before {
height: 35px;
}
Basically what was causing that gap was the margin from the h2.child-header. So you need to change it for a padding and then just modify the .child-header:after top value and that's all.
Hope I've been able to help you.
Upvotes: 1