JSFiddle - React, Tailwind, and code Playground
by Arnold Daniels
HTML
<div class="timeline">
<div class="event" style="left: 10%">
<div class="description">Now it starts</div>
<div class="date">may 2014</div>
</div>
<div class="event" style="left: 60%">
<div class="description">Something happened</div>
<div class="date">dec 2016</div>
</div>
<div class="event" style="left: 80%">
<div class="description">We did it!</div>
<div class="date">jan 2018</div>
</div>
</div>
CSS
.timeline {
position: relative;
height: 160px;
overflow: hidden;
}
.timeline:after {
display: block;
content: " ";
border: 4px solid black;
position: absolute;
top: calc(50% + 2px);
width: 100%;
}
.timeline .event {
position: absolute;
text-align: center;
width: 250px;
top: calc(50% - 30px);
margin-left: -125px;
z-index: 1;
}
.timeline .event:after {
content: " ";
position: absolute;
border-radius: 50%;
border: 1px solid black;
background-color: #fff;
width: 20px;
height: 20px;
top: calc(50% - 10px);
left: calc(50% - 10px);
z-index: 2;
}
.timeline .event .date {
margin-top: 35px;
}