Timeline with CSS

In this article, we are gonna build a timeline for your website which you can use later on in your portfolio to display your work history or maybe something else you want. Let’s first look at what are we building –

Now you have seen what we are up t…


This content originally appeared on DEV Community and was authored by Jatin Sharma

In this article, we are gonna build a timeline for your website which you can use later on in your portfolio to display your work history or maybe something else you want. Let's first look at what are we building -

preview

Now you have seen what we are up to so let's get hands in the code -

HTML

<div class="timeline">
  <div class="outer">
    <!-- .... card before this -->
    <div class="card">
      <div class="info">
        <h3 class="title">Title</h3>
        <p>
          Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do
          eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad
          minim veniam, quis nostrud exercitation ullamco laboris nisi ut
          aliquip ex ea commodo consequat.
        </p>
      </div>
    </div>

    <!-- ..... you can add more div with "card" class -->
  </div>
</div>

In the HTML code, the timeline class is the main container and the outer class is the wrapper for all the cards. and then we have a card in which we add data.

Now let's look at the CSS -

CSS

/* Timeline Container */
.timeline {
  background: #fff;
  margin: 20px auto;
  padding: 20px;
}

/* Outer Layer with the timeline border */
.outer {
  border-left: 2px solid #333;
}

/* Card container */
.card {
  position: relative;
  margin: 0 0 20px 20px;
  padding: 10px;
  background: #333;
  color: gray;
  border-radius: 8px;
  max-width: 400px;
}

/* Information about the timeline */
.info {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

/* Title of the card */
.title {
  color: orangered;
  position: relative;
}

/* Timeline dot  */
.title::before {
  content: "";
  position: absolute;
  width: 10px;
  height: 10px;
  background: white;
  border-radius: 999px;
  left: -39px;
  border: 3px solid orangered;
}

Codepen is Here

See the Pen css-timeline by Jatin (@j471n) on CodePen.

Conclusion

This is just the beginning, you can customize it to the next level, and maybe I'll do in the future article to stay tuned for that if you have any suggestions then comment below.

You can now extend your support by buying me a Coffee.😊👇

Buy Me A Coffee


This content originally appeared on DEV Community and was authored by Jatin Sharma


Print Share Comment Cite Upload Translate Updates
APA

Jatin Sharma | Sciencx (2021-11-10T07:59:46+00:00) Timeline with CSS. Retrieved from https://www.scien.cx/2021/11/10/timeline-with-css/

MLA
" » Timeline with CSS." Jatin Sharma | Sciencx - Wednesday November 10, 2021, https://www.scien.cx/2021/11/10/timeline-with-css/
HARVARD
Jatin Sharma | Sciencx Wednesday November 10, 2021 » Timeline with CSS., viewed ,<https://www.scien.cx/2021/11/10/timeline-with-css/>
VANCOUVER
Jatin Sharma | Sciencx - » Timeline with CSS. [Internet]. [Accessed ]. Available from: https://www.scien.cx/2021/11/10/timeline-with-css/
CHICAGO
" » Timeline with CSS." Jatin Sharma | Sciencx - Accessed . https://www.scien.cx/2021/11/10/timeline-with-css/
IEEE
" » Timeline with CSS." Jatin Sharma | Sciencx [Online]. Available: https://www.scien.cx/2021/11/10/timeline-with-css/. [Accessed: ]
rf:citation
» Timeline with CSS | Jatin Sharma | Sciencx | https://www.scien.cx/2021/11/10/timeline-with-css/ |

Please log in to upload a file.




There are no updates yet.
Click the Upload button above to add an update.

You must be logged in to translate posts. Please log in or register.