Utilizing the power of flex layout makes solving this issue a breeze. Flex layout offers a much simpler way to arrange complex applications compared to the traditional block layout method suggested in other responses.
Exploring flex and grid layouts can greatly enhance the organization of modern applications.
.root {
display: flex;
flex-direction: column;
align-items: center;
color: blue;
}
.line {
height: 30px;
width: 0px;
border: solid
}
<div class='root'>
<div class='line'></div>
<div class='text'>2016</div>
<div class='line'></div>
<div class='text'>2014</div>
<div class='line'></div>
<div class='text'>2012</div>
<div class='line'></div>
<div class='text'>2010</div>
<div class='line'></div>
</div>
Check out the sample link for reference.