Skip to content

Instantly share code, notes, and snippets.

@mattConn
Last active January 7, 2023 23:28
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save mattConn/4dd2f082733a6eaac81bdda1c5e52f6b to your computer and use it in GitHub Desktop.
Save mattConn/4dd2f082733a6eaac81bdda1c5e52f6b to your computer and use it in GitHub Desktop.
Vertical timeline component. Example: https://mattconn.github.io/timeline/
/* timeline event styles */
.timeline-event {
display: flex;
}
.timeline-event .timeline-event_copy {
padding: 0 1em;
}
.timeline-event .timeline-event_copy.current {
background-color: #dedef9;
}
/*
Making this shape:
|
201x |-- Event
|
There is a vertical line, and a horizontal line per event.
*/
/* vertical line */
.timeline-event .timeline-event_lines {
border-left: 3px solid black;
}
/* horizontal line */
.timeline-event .timeline-event_lines div {
border-bottom: solid 1px black;
padding: 1em;
}
/* end timeline event styles */
<div class = "timeline-event">
<div class="timeline-event_copy">
<h1>2016</h1>
</div>
<!-- vertical and horizontal lines -->
<div class="timeline-event_lines">
<div>
</div>
</div>
<div class="timeline-event_copy">
<h1>Event Title</h1>
<p>Event description.</p>
<p>More event copy.</p>
</div>
</div>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment