Skip to content

Alternating Timeline

Pure CSS vertical timeline with a center line and entries that alternate left and right, collapsing to a single column on mobile.

Also known as: vertical timeline, zigzag timeline, alternating timeline layout, history timeline

Alternating Timeline live demo

Open in new tab

Pure CSS code (HTML, CSS)

An alternating vertical timeline in pure CSS: a center line runs down the page and the entries switch between the left and right side, each with a dot on the line and a small arrow pointing to it. It fits company history pages, product roadmaps, project milestones and resumes, and needs no JavaScript.

How it works

The root section.tla-section holds a centered .tla-header and an ordered list, ol.tla-list, because the entries follow a sequence. Every li.tla-item wraps an article.tla-card with a time.tla-date pill, an h3.tla-title and a p.tla-text.

The vertical line is the ::before pseudo-element of .tla-list, and each dot is the ::before of a .tla-item. The arrow is a CSS border triangle on .tla-card::before, colored like the card so it looks like part of it.

The layout is mobile first. On small screens the line sits on the left, the list is indented by --tla-gap and every card points left. From 768px the line moves to left: 50%, each item takes half the width, and :nth-child(even) items get margin-left: 50%, so entries alternate sides. Odd items are right-aligned, their dot sits on the right edge and their arrow is flipped to point right. From 1024px each item gets a negative top margin so the two columns interlock and the timeline feels tighter. The .tla-item--current modifier fills the dot, adds a soft halo and outlines the card to mark the present step.

Customization

  • --tla-accent on .tla-section: color of the dots, date pills, kicker text and the current-step outline.
  • --tla-line and --tla-line-width: color and thickness of the center line.
  • --tla-dot: diameter of the dots on the line.
  • --tla-gap: distance between the line and the cards, on mobile and desktop.
  • --tla-arrow: size of the triangle pointing from each card to the line; set it to 0 to hide it.
  • --tla-bg and --tla-card-bg: page and card backgrounds. The arrow follows --tla-card-bg automatically.
  • Move .tla-item--current (and aria-current="step") to another li to highlight a different milestone.
  • The margin-top: -2.5rem rule in the 1024px media query controls how much the columns overlap; remove it for a strictly stacked layout.

Use cases

  • Company history pages: entries alternate left and right of a center line as the story unfolds
  • Product roadmaps: each milestone gets a dot on the line and a small arrow pointing to it
  • Project milestones: the layout collapses to a single column on mobile screens
  • Resumes and portfolios: career steps appear in order without any JavaScript

Accessibility

The entries are an ordered list, so screen readers announce their number and position, and the reading order stays chronological on every screen size because only CSS moves the items. Each entry is an article with its own heading, which makes the timeline easy to navigate by headings. Dates use time elements with machine-readable datetime values. The current milestone carries aria-current="step", so it is not marked by color alone. The line, dots and arrows are pseudo-elements and are ignored by assistive technology. The timeline has no animation, so there is nothing to disable for prefers-reduced-motion, and the muted text keeps good contrast on the white cards.

Usage notes

Add more entries by copying a li.tla-item; the alternation follows :nth-child, so no extra classes are needed. Keep the cards of similar length on desktop for the most even rhythm.

Alternating Timeline at a glance

Framework
Pure CSS
Code
HTML, CSS
JavaScript
Not needed, CSS only
Dependencies
None
Layout
Responsive, works on mobile
Category
Timelines
License
Free for personal and commercial use

Questions about this template

Can I use the Alternating Timeline code for free?

Yes. You can copy or download the code and use it in personal and commercial projects, including client work. No sign-up is needed. Reselling it as part of a component library or template collection is not allowed; see the license.

How do I add it to my website?

There is nothing to install. Paste the HTML where the component should appear and add the CSS to your stylesheet. Download HTML gives you a complete page with everything already linked.

Does it need jQuery or a JavaScript framework?

No. It is built with HTML and CSS only, so there is no JavaScript to load.

Does it work on mobile?

Yes. The layout adapts to small screens. Use the Mobile and Tablet buttons above the live demo to check it at phone and tablet width.

Requirements

No dependencies. Pure HTML, CSS and JavaScript.

Alternating Timeline – free Pure CSS timeline template
Alternating Timeline · free Pure CSS timeline template

More Timelines

Timeline with Scroll Progress Line – free Pure CSS timeline template

Timeline with Scroll Progress Line

Dark vertical timeline whose glowing center line fills as you scroll, lighting up each milestone when it is reached. Alternating cards on desktop.

Vertical Timeline – free Tailwind CSS timeline template

Vertical Timeline

Responsive Tailwind CSS vertical timeline with icon markers, dates, category labels and descriptions that alternate left and right on wider screens.

Activity Feed Timeline – free Bootstrap 5 timeline template

Activity Feed Timeline

Dark Bootstrap 5 activity feed timeline with colored event icons, timestamps, quoted comments and filter chips for code, comments and deploys.