Timeline Using HTML & CSS
OUTPUT:-
HTML:-<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8">
<title>Timeline Using Html Css</title>
<meta content="width=device-width, initial-scale=1.0" name="viewport">
<!-- Stylesheet -->
<link href="timeline.css" rel="stylesheet">
</head>
<body>
<div class="timeline">
<div class="container left">
<div class="date">15 Dec</div>
<div class="content">
<h2>Lorem ipsum dolor sit amet</h2>
<p>
Lorem ipsum dolor sit amet elit. Aliquam odio dolor, id luctus erat sagittis non. Ut blandit semper pretium.
</p>
</div>
</div>
<div class="container right">
<div class="date">22 Oct</div>
<div class="content">
<h2>Lorem ipsum dolor sit amet</h2>
<p>
Lorem ipsum dolor sit amet elit. Aliquam odio dolor, id luctus erat sagittis non. Ut blandit semper pretium.
</p>
</div>
</div>
<div class="container left">
<div class="date">10 Jul</div>
<div class="content">
<h2>Lorem ipsum dolor sit amet</h2>
<p>
Lorem ipsum dolor sit amet elit. Aliquam odio dolor, id luctus erat sagittis non. Ut blandit semper pretium.
</p>
</div>
</div>
<div class="container right">
<div class="date">18 May</div>
<div class="content">
<h2>Lorem ipsum dolor sit amet</h2>
<p>
Lorem ipsum dolor sit amet elit. Aliquam odio dolor, id luctus erat sagittis non. Ut blandit semper pretium.
</p>
</div>
</div>
<div class="container left">
<div class="date">10 Feb</div>
<div class="content">
<h2>Lorem ipsum dolor sit amet</h2>
<p>
Lorem ipsum dolor sit amet elit. Aliquam odio dolor, id luctus erat sagittis non. Ut blandit semper pretium.
</p>
</div>
</div>
<div class="container right">
<div class="date">01 Jan</div>
<div class="content">
<h2>Lorem ipsum dolor sit amet</h2>
<p>
Lorem ipsum dolor sit amet elit. Aliquam odio dolor, id luctus erat sagittis non. Ut blandit semper pretium.
</p>
</div>
</div>
</div>
</body>
</html>
CSS:-
*,
*::before,
*::after {
box-sizing: border-box;
}
body {
margin: 0;
font-family: Arial, Helvetica, sans-serif;
background: #ffffff;
}
.timeline {
position: relative;
width: 100%;
max-width: 1140px;
margin: 0 auto;
padding: 15px 0;
}
.timeline::after {
content: '';
position: absolute;
width: 2px;
background: #006E6D;
top: 0;
bottom: 0;
left: 50%;
margin-left: -1px;
}
.container {
padding: 15px 30px;
position: relative;
background: inherit;
width: 50%;
}
.container.left {
left: 0;
}
.container.right {
left: 50%;
}
.container::after {
content: '';
position: absolute;
width: 16px;
height: 16px;
top: 48px;
right: -8px;
background: #006E6D;
border-radius: 16px;
z-index: 1;
}
.container.right::after {
left: -8px;
}
.container::before {
content: '';
position: absolute;
width: 0;
height: 0;
top: 46px;
right: 10px;
z-index: 1;
border: 10px solid;
border-color: transparent transparent transparent #006E6D;
}
.container.right::before {
left: 10px;
border-color: transparent #006E6D transparent transparent;
}
.container .date {
content: '';
position: absolute;
display: inline-block;
top: 48px;
text-align: center;
font-size: 14px;
font-weight: bold;
color: #006E6D;
text-transform: uppercase;
letter-spacing: 1px;
z-index: 1;
}
.container.left .date {
right: -75px;
}
.container.right .date {
left: -75px;
}
.container .content {
padding: 30px;
background: #ffffff;
position: relative;
border: 1px solid #eeeeee;
border-right: 5px solid #006E6D;
border-left: 5px solid #eeeeee;
border-radius: 15px 0 0 15px;
box-shadow: 0 0 60px rgba(0, 0, 0, .08);
}
.container.right .content {
border-right: 5px solid #eeeeee;
border-left: 5px solid #006E6D;
border-radius: 0 15px 15px 0;
}
.container .content h2 {
margin: 0 0 10px 0;
font-size: 18px;
font-weight: normal;
color: #006E6D;
}
.container .content p {
margin: 0;
font-size: 16px;
line-height: 22px;
color: #454545;
}
@media (max-width: 767.98px) {
.timeline::after {
left: 90px;
}
.container {
width: 100%;
padding-left: 120px;
padding-right: 30px;
}
.container.right {
left: 0%;
}
.container.left::after,
.container.right::after {
left: 82px;
}
.container.left::before,
.container.right::before {
left: 100px;
border-color: transparent #006E6D transparent transparent;
}
.container.left .date,
.container.right .date {
right: auto;
left: 15px;
}
.container.left .content,
.container.right .content {
border-right: 5px solid #eeeeee;
border-left: 5px solid #006E6D;
border-radius: 0 15px 15px 0;
}
}