Summarize this article with:

Timelines turn boring lists into visual stories. Whether you’re building a company history page, project roadmap, or event schedule, CSS timeline examples give you the code patterns to make it happen.

No JavaScript required for most designs. Pure CSS handles the layout, connectors, markers, and even animations.

This guide covers vertical and horizontal timeline layouts, responsive patterns using flexbox and grid, animated effects with pseudo-elements, and accessibility requirements you shouldn’t skip.

You’ll find working code for simple timelines and complex alternating designs. Copy what works. Modify what doesn’t.

What is a CSS Timeline

A CSS timeline is a visual component that displays events, steps, or milestones in chronological order using HTML and CSS properties.

Timeline components use flexbox, grid positioning, and pseudo-elements to create vertical or horizontal layouts with connected nodes and content blocks.

You’ll find them on company history pages, project roadmaps, resume websites, and event listings.

The structure relies on container elements, individual timeline items, connector lines built with ::before and ::after selectors, and circular markers styled with border-radius.

How Does a CSS Timeline Work

Timeline layouts work through a combination of relative and absolute positioning.

The main container establishes a positioning context. Each timeline item sits inside this container with its own content card.

Connector lines run between items using pseudo-elements. These ::before and ::after selectors create thin vertical or horizontal bars through background-color or border properties.

Markers (those circular dots you see) use border-radius: 50% to form perfect circles. They sit at connection points between the line and content.

Is responsive design still a top priority?

Explore the latest responsive design statistics: adoption rates, performance impact, user behavior, and trends shaping modern websites.

See the Numbers →

The display: flex property with flex-direction: column handles vertical stacking. For horizontal timelines, flex-direction: row does the work.

Z-index values control which elements appear on top. Markers typically need higher z-index than connector lines.

What Are the Types of CSS Timelines

Timeline designs fall into several categories based on layout direction and interaction patterns:

  • Vertical timelines – Content flows top to bottom, most common for mobile screens
  • Horizontal timelines – Events spread left to right, works well for desktop displays
  • Alternating timelines – Items switch between left and right sides using nth-child selectors
  • Responsive timelines – Layout changes based on media queries and viewport width
  • Animated timelines – Include transition effects, hover states, and scroll-triggered animations

Each type serves different user experience goals. Vertical works best for storytelling. Horizontal suits process flows.

CSS Timeline Examples To Check Out

Pure CSS Timeline Card

See the Pen
pure css timeline card
by Ajay (@hello-ajayrawat)
on CodePen.

Vertical Timeline With Hover Effects

Life Timeline

Stepped Process Timeline

Scroll Timeline

Grid Style Timeline

Horizontal Timeline Mockup V2

CSS Timeline Ching C Lee

Centered Responsive Timeline

Responsive Slider Timeline With Swiper

Left-to-Right Vertical Timeline

Timeline Scribble

CSS Timeline For Giggles

Timeline sequence V1

Swiping Horizontal Timeline

Animated Circle Timeline

Horizontal CSS and HTML timeline

Bitcoin Timeline With Fixed Header

Responsive timeline V3

PS Group Timeline 2

Responsive History Timeline

Timeline UI

Project Timeline

Timeline Style Navigation

Comments And Feedback Timeline

Timeline in Flexbox

CSS Timeline v2

Narrow Vertical Timeline

Animated SVG Travel Timeline

Timeline in CSS

Timeline By Radhika

Simple Responsive Timeline

Responsive Grid Timeline

HR Timeline

CSS Timeline with Custom Properties

How to Create a CSS Timeline

Building a timeline from scratch requires structured HTML markup and layered CSS styling.

Follow this process to create a functional vertical timeline component.

What HTML Structure Does a CSS Timeline Need

Timeline markup uses semantic HTML elements for accessibility and SEO.

The outer container is typically a div or section with a class like “timeline”. Inside, each event uses an article or div element.

Basic structure looks like this:

  • Container wrapper (div.timeline)
  • Timeline items (div.timeline-item or article)
  • Content wrapper (div.timeline-content)
  • Date/time element (time or span.date)
  • Title and description (h3 and p tags)

Use accessible tables if presenting tabular timeline data.

How to Style the Timeline Container

The container establishes the positioning context for all child elements.

Set position: relative on the main wrapper. This allows absolute positioning for the connector line and markers.

Add padding on the left side (40-60px) to create space for the vertical line. Max-width keeps content readable on large screens.

How to Create Timeline Connectors

Connector lines use the ::before pseudo-element on the timeline container.

Position it absolutely with left: 20px (or wherever your markers sit). Set width: 2-4px and height: 100%.

Background-color creates a solid line. Use CSS gradients for fading effects at top and bottom.

For segmented connectors, apply border-style: dashed or dotted instead.

How to Position Timeline Items

Each timeline item needs relative positioning for its own marker placement.

Margin-bottom creates vertical spacing between events. Values of 30-50px work well for most designs.

Padding-left pushes content away from the connector line. Match this to your marker position plus some breathing room.

How to Add Timeline Markers

Markers use the ::before pseudo-element on timeline items.

Position: absolute with left and top values place the marker precisely. Use transform: translateY(-50%) for vertical centering.

Circle markers need equal width and height plus border-radius: 50%. Common sizes range from 12px to 24px.

Background-color fills the circle. Border adds definition against similar backgrounds.

How to Make a CSS Timeline Responsive

Responsive timelines require breakpoint adjustments through media queries.

At mobile sizes (under 600px), remove alternating layouts. Stack everything vertically with markers on the left.

Reduce padding and margin values proportionally. Font sizes should use rem or viewport units for scaling.

Test on actual devices. Chrome DevTools device emulation catches most layout issues.

CSS Timeline Properties and Values

These specific CSS properties control timeline appearance and behavior.

Which CSS Properties Are Used in Timelines

Core layout properties include:

  • display: flex and flex-direction: column for vertical stacking
  • position: relative/absolute for marker and line placement
  • ::before and ::after pseudo-elements for decorative elements
  • border-radius: 50% for circular markers
  • z-index for layering control
  • transform: translateX/translateY for precise positioning

Animation properties include transition, animation, and @keyframes rules.

What Are the Best CSS Values for Timeline Markers

Marker sizing depends on timeline density and screen size.

Desktop markers: 16-24px diameter. Mobile markers: 12-16px diameter.

Border width of 2-3px provides definition. Use color contrast ratios of 4.5:1 minimum for accessibility.

Box-shadow adds depth: box-shadow: 0 2px 4px rgba(0,0,0,0.2).

How Do Pseudo-Elements Work in CSS Timelines

::before and ::after create elements without adding HTML markup.

The content property is required (even if empty: content: “”). Position: absolute removes them from document flow.

Timeline connectors use ::before on containers. Markers use ::before on individual items.

Multiple pseudo-elements on the same element allow complex designs without extra divs.

CSS Timeline Browser Compatibility

Modern CSS timeline techniques work across all current browsers.

Which Browsers Support CSS Timeline Features

Cross-browser compatibility for core features:

  • Flexbox – 99.5% global support (IE11 partial)
  • CSS Grid – 96% global support
  • Pseudo-elements – 100% support in all modern browsers
  • CSS Transitions – 98% support
  • CSS Animations – 98% support

No vendor prefixes needed for Chrome 88+, Firefox 85+, Safari 14+, and Edge 88+.

Test with Can I Use database for specific property support data.

CSS Timeline Accessibility

Accessible timelines work for keyboard users, screen readers, and people with visual impairments.

How to Make CSS Timelines Accessible

Use semantic HTML: ordered lists (ol) for sequential events, unordered lists (ul) for non-sequential content.

Add ARIA labels to timeline containers: aria-label=”Company history timeline” helps screen reader users understand the component purpose.

Follow the web accessibility checklist for complete compliance.

Key accessibility requirements:

  • Keyboard navigation – all interactive elements reachable via Tab key
  • Focus indicators – visible outline on focused items, minimum 2px width
  • Color independence – don’t rely on color alone to convey meaning
  • Text alternatives – descriptive alt text for icon markers
  • Readable fonts – use accessible typography with 16px minimum base size

Test with VoiceOver (Mac), NVDA (Windows), and keyboard-only navigation.

Motion-sensitive users need reduced motion support: @media (prefers-reduced-motion: reduce) disables animations.

CSS Timeline Design Patterns

These design patterns solve common timeline layout challenges.

Vertical Timeline Patterns

Single-column vertical timelines work best for mobile screens and long event lists.

Content cards stack with consistent left margins. The connector line runs along the left edge at 20-30px from the container boundary.

Spacing between items should follow a rhythm: 40px gap for desktop, 24px for mobile.

Horizontal Timeline Patterns

Horizontal layouts suit process flows and limited event counts (under 10 items).

Use overflow-x: auto with scroll-snap-type: x mandatory for touch-friendly horizontal scrolling.

Items need fixed or percentage widths. Flexible widths break horizontal alignment.

Alternating Layout Patterns

Alternating timelines create visual interest through left-right item placement.

The :nth-child selector controls positioning: odd items float left, even items float right.

Center the connector line with left: 50% and transform: translateX(-50%).

Card-Based Timeline Patterns

Card patterns wrap timeline content in styled containers with CSS shadow effects and borders.

CSS cards provide clear visual separation between events. Add CSS card hover effects for interactive feedback.

Border-radius of 8-12px softens card edges. Padding of 16-24px creates internal breathing room.

CSS Timeline Animation Techniques

Animations bring timelines to life through motion and visual feedback.

Scroll-Triggered Animations

CSS animations on scroll reveal timeline items as users scroll down the page.

Intersection Observer API triggers CSS class additions when elements enter the viewport.

Start items with opacity: 0 and transform: translateY(20px). Animate to opacity: 1 and translateY(0).

Hover State Animations

Hover animations use CSS animation properties and transition timing functions.

Scale transforms (1.02-1.05) create subtle growth. Background-color shifts provide clear feedback.

CSS button hover effects techniques apply to timeline markers and action elements.

Loading Animations

CSS loaders display while timeline data fetches from external sources.

Skeleton screens show placeholder timeline shapes during loading states.

Use CSS spinners for simple loading indicators on individual timeline items.

Progress Animations

CSS progress bar techniques animate the connector line to show completion status.

Width or height animations reveal the line progressively. Combine with scroll position for dynamic progress tracking.

CSS Timeline Styling Variations

Visual styling options customize timeline appearance for different brands and contexts.

Minimalist Timeline Styles

Minimalist design strips timelines to essential elements: thin lines, small markers, clean typography.

Monochromatic color schemes work well. Single accent color for markers, neutral grays for text and lines.

Generous white space between items prevents visual clutter.

Glassmorphism Timeline Styles

CSS glassmorphism creates frosted glass effects on timeline cards.

Use backdrop-filter: blur(10px) with semi-transparent backgrounds. The CSS glassmorphism generator creates ready-to-use code.

Neumorphism Timeline Styles

CSS neumorphism adds soft, extruded effects to timeline elements.

Dual box-shadows (light and dark) create the raised appearance. Works best on light gray backgrounds.

Gradient Timeline Styles

Gradient backgrounds on connector lines add visual flow. Linear gradients transition between brand colors.

Apply gradients to markers for multi-color timeline nodes. The CSS Border Radius Generator helps create consistent rounded shapes.

CSS Timeline Code Organization

Clean code structure makes timelines maintainable and reusable.

CSS Class Naming Conventions

BEM naming works well for timeline components:

  • .timeline (block)
  • .timelineitem (element)
  • .timelinemarker (element)
  • .timelinecontent (element)
  • .timeline–horizontal (modifier)
  • .timeline–alternating (modifier)

Consistent naming prevents specificity conflicts and improves team collaboration.

CSS Custom Properties for Timelines

CSS variables centralize timeline styling values for easy customization.

Define at root level: –timeline-line-color, –timeline-marker-size, –timeline-spacing.

Override variables for theme variations without rewriting component styles.

Modular Timeline CSS

Split timeline styles into logical files: base layout, markers, animations, responsive breakpoints.

Use CSS Minifier for production builds. Keep development files readable with CSS Beautifier.

CSS Timeline Performance

Optimized timelines load fast and animate smoothly.

Render Performance Tips

Use transform and opacity for animations. These properties trigger GPU acceleration and avoid layout recalculations.

Avoid animating width, height, margin, or padding. These cause expensive reflows.

Will-change: transform hints to browsers about upcoming animations. Use sparingly.

File Size Optimization

Minify production CSS to reduce file size. Remove unused timeline variations.

Inline critical timeline styles in the document head. Load secondary animations asynchronously.

Use system fonts or subset custom fonts to reduce web font payload.

Image and Icon Optimization

Vector markers using SVG in HTML scale without quality loss.

Optimize SVG icons before embedding. Remove unnecessary metadata and simplify paths.

Consider the difference between SVG and PNG when choosing marker formats. SVG wins for scalability.

CSS Timeline Integration

Timelines work with popular frameworks and existing design systems.

Bootstrap Timeline Integration

Bootstrap timeline components use the framework’s grid and utility classes.

Combine with Bootstrap cards for styled content containers.

Bootstrap animations add motion without custom keyframes.

Framework-Agnostic Timelines

Pure CSS timelines work in any frontend framework: React, Vue, Angular, or vanilla JavaScript.

Keep timeline CSS separate from framework-specific styles for maximum portability.

Component-based frameworks benefit from scoped timeline styles that don’t leak globally.

CMS and Template Integration

Timeline HTML structures integrate with WordPress, Shopify, and static site generators.

Use shortcodes or block patterns for repeatable timeline implementations.

Dynamic timelines pull data from backend APIs and render client-side or server-side.

FAQ on CSS Timeline Examples

How do I create a simple CSS timeline?

Build a container div with position: relative. Add timeline items inside with content cards. Use ::before pseudo-elements for the connector line and circular markers. Apply flexbox with flex-direction: column for vertical stacking.

What is the best CSS property for timeline layouts?

Display: flex handles most timeline layouts effectively. Combine it with flex-direction for orientation control. For complex grids with multiple columns, CSS Grid offers more precise placement of timeline items and content blocks.

How do I make a horizontal timeline in CSS?

Set flex-direction: row on the container. Position the connector line using ::before with width: 100% and height: 2px. Add overflow-x: auto for scrollable timelines that exceed viewport width on smaller screens.

Can I create an animated timeline without JavaScript?

Yes. Pure CSS animations handle most timeline effects. Use @keyframes for complex sequences, transition properties for hover states, and the :target selector for click-triggered reveals. Animation-delay staggers item appearances.

How do I make timeline markers circular?

Apply border-radius: 50% to elements with equal width and height values. A 20px by 20px element with border-radius: 50% creates a perfect circle. Use background-color for fill and border for definition.

What HTML structure works best for timelines?

Use semantic markup: section or div for the container, article or div for items, time elements for dates. Ordered lists (ol/li) work well for sequential events and improve screen reader navigation.

How do I create an alternating timeline layout?

Apply :nth-child(odd) and :nth-child(even) selectors to position items on opposite sides. Use margin-left: 50% for right-aligned items, margin-right: 50% for left-aligned. Center the connector line at left: 50%.

Are CSS timelines responsive?

They require media query adjustments. Switch from horizontal to vertical layout at smaller breakpoints. Convert alternating layouts to single-column below 768px. Adjust marker sizes, spacing values, and font sizes proportionally.

How do I connect timeline items with a line?

Create a ::before pseudo-element on the timeline container. Set position: absolute, width: 2-4px for vertical lines or height: 2-4px for horizontal. Apply background-color and position with top, left, bottom values.

What are common CSS timeline accessibility issues?

Missing keyboard navigation, insufficient color contrast on markers, no focus indicators, and relying on color alone for meaning. Add ARIA labels, ensure 4.5:1 contrast ratios, and test with screen readers.

Conclusion

These CSS timeline examples give you the foundation to build chronological displays that actually work. Pick a pattern, grab the code, and adapt it to your project.

Start simple. A vertical timeline with flexbox covers most use cases.

Add complexity only when needed. Alternating layouts, scroll-triggered animations, and custom markers come later.

Don’t skip accessibility. Keyboard navigation, proper contrast ratios, and semantic HTML matter more than fancy effects.

Test across Chrome, Firefox, Safari, and Edge. Check mobile behavior at multiple breakpoints.

The best timeline is the one users actually understand. Keep connector lines clean, markers consistent, and content scannable.

Now build something.

Author

Bogdan Sandu specializes in web and graphic design, focusing on creating user-friendly websites, innovative UI kits, and unique fonts.Many of his resources are available on various design marketplaces. Over the years, he's worked with a range of clients and contributed to design publications like Designmodo, WebDesignerDepot, and Speckyboy, Slider Revolution among others.