<div class="timeline-container">
<div class="timeline-block timeline-block-right">
<div class="marker"></div>
<div class="timeline-content">
<h3>2020</h3>
<strong>10 Oct</strong>
<p>Long text...</p>
</div>
</div>
<div class="timeline-block timeline-block-left">
<div class="marker"></div>
<div class="timeline-content">
<h3>2021</h3>
<strong>5 Sep</strong>
<p>Text.</p>
</div>
</div>
<div class="timeline-block timeline-block-right">
<div class="marker"></div>
<div class="timeline-content">
<h3>2022</h3>
<strong>1 Jan</strong>
<p>Another text.</p>
</div>
</div>
</div>
.timeline-container {
width: 90%;
padding: 50px 0;
margin: 25px auto;
position: relative;
overflow: hidden;
&::before {
content: "";
position: absolute;
top: 0;
left: 50%;
margin-left: -1px;
width: 2px;
height: 100%;
background: #f6f6f6;
background: linear-gradient(
to bottom,
transparent 0%,
#f6f6f6 5%,
#f6f6f6 95%,
transparent 100%
);
z-index: 1;
}
}
.timeline-block {
width: calc(50% + 8px);
display: flex;
justify-content: space-between;
clear: both;
&-right {
float: right;
text-align: left;
}
&-left {
float: left;
text-align: right;
direction: rtl;
}
}
.marker {
width: 16px;
height: 16px;
border-radius: 50%;
border: 2px solid #abc9db;
background: #abc9db;
margin-top: 10px;
z-index: 2;
}
.timeline-content {
width: 95%;
padding: 0 15px;
h3 {
margin-top: 5px;
font-weight: 500;
margin-bottom: 5px;
}
p {
word-spacing: 1px;
direction: ltr;
hyphens: auto;
hyphenate-limit-chars: 6 3 2;
hyphenate-limit-lines: 2;
hyphenate-limit-last: always;
hyphenate-limit-zone: 8%;
}
}
@media screen and (max-width: 768px) {
.timeline-container::before {
left: 8px;
width: 2px;
}
.timeline-block {
width: 100%;
margin-bottom: 30px;
text-align: left;
}
.timeline-block-right {
float: none;
}
.timeline-block-left {
float: none;
direction: ltr;
}
}
View Compiled
This Pen doesn't use any external CSS resources.
This Pen doesn't use any external JavaScript resources.