If you do not need black borders around each element (as can be seen from the published image), you can still create the necessary shapes in the borderfollowing way:
.timeline-unit:before, .timeline-unit:after {
top: 0;
border: solid transparent;
border-width: 1.65em;
height: 0;
width: 0;
position: absolute;
pointer-events: none;
}
.timeline-unit:after {
content: " ";
left: 100%;
border-left-color: rgba(51, 51, 51, 0.8);
}
.timeline-unit {
position: relative;
display: inline-block;
background: rgba(51,51,51,.8);
padding: 1em;
line-height: 1.25em;
color: #FFF;
}
.timeline-unit:before { content: none; }
.timeline-unit + .timeline-unit:before {
content: " ";
border-color: rgba(51, 51, 51, 0.8);
border-left-color: transparent;
border-right: 0;
right: 100%;
}
.timeline-unit + .timeline-unit {
margin-left: 2em;
}
body {
background: red;
-webkit-animation: bgcolor 4s linear 0s infinite alternate;
-moz-animation: bgcolor 4s linear 0s infinite alternate;
-o-animation: bgcolor 4s linear 0s infinite alternate;
animation: bgcolor 4s linear 0s infinite alternate;
}
@-webkit-keyframes bgcolor { from { background: red; } to { background: green; } }
@-moz-keyframes bgcolor { from { background: red; } to { background: green; } }
@-o-keyframes bgcolor { from { background: red; } to { background: green; } }
@keyframes bgcolor { from { background: red; } to { background: green; } }
<div class="timeline-unit"> Timeline 1 </div>
<div class="timeline-unit"> Timeline 2 </div>
<div class="timeline-unit"> Timeline 3 </div>
Run codeHowever, if you need to add a border for each element, there are two options: