Build an Interactive American Revolution Timeline with Event Filters in HTML
A single HTML file that renders a filterable American Revolution timeline from 1763 to 1783, scrolling sideways on desktop and stacking vertically on phones.
You getone complete HTML file in a single code block, then 3 short ideas to extend it.
The prompt
You are a front-end developer and information designer who builds clear, accessible history explainers.
Build a single-page interactive infographic called "Road to Independence" covering the American Revolution from 1763 to 1783. Show about 19 accurate key events, each tagged Political, Military or Social. Each event card shows a type badge, a large year, the exact date, a title, a 1-2 sentence summary, and a "Why it mattered" button that expands one extra sentence.
Rules:
1. Layout: on screens wider than 640px, the timeline is a horizontal, scroll-snapping row of cards on a connecting line with colored dots, plus previous and next arrow buttons. At 640px and below, it stacks vertically with the line on the left.
2. Filters: chips for All, Political, Military and Social, each showing its event count. Clicking a type chip while All is active isolates that type. Later clicks toggle types, and turning every type off resets to All. Use aria-pressed and a live line reading "Showing X of Y events".
3. Keyboard: arrow keys, Home and End move focus between visible cards and scroll the active card into view. Every control has a visible focus ring.
4. Palette: parchment background, dark ink text, navy for political, brick red for military, forest green for social, with readable contrast. Georgia headings and system body text.
5. Motion: smooth scrolling and a slight card lift on hover, both turned off under prefers-reduced-motion.
6. No external files, fonts or libraries.
Output format: one complete HTML file in a single code block, then 3 short ideas to extend it.Example output
Tips and common edits
Why this works
- Fixing a breakpoint at 640px tells the model exactly when to switch from a horizontal row to a vertical stack.
- Spelling out the chip logic (isolate, toggle, reset) avoids the common bug where filters can hide every event.
- Asking for real dates and a 'why it mattered' line produces teachable content, not filler cards.
Paste into ChatGPT, Claude or Gemini. Save the returned code as revolution-timeline.html and open it in any browser, or view it in the chat's preview or canvas panel.
Common edits
- Swap the topic and events for another era, such as the Civil Rights Movement, keeping the same three filter categories.
- Add a fourth category like Economic with its own color, or change the palette to match your school or brand.
Prompt details
- By
- Prompts-GPT editors
- Published
Did this prompt work?
Keep exploring
More like this
Build an Interactive History Timeline with Era Bands and Clickable Event Cards
Get a single-file interactive timeline with color-coded era bands, zoom controls, keyboard navigation and expandable event cards, ready for a history lesson.
Build a Vertical Biography Timeline Infographic of a Famous Scientist in HTML
You get one HTML file with an alternating vertical timeline of a scientist's life, including milestones, quotes and awards, category filters and expandable details.
Build an Interactive Cause-and-Effect Infographic on the Causes of World War I
An interactive infographic in one HTML file that links World War I causes with arrows and reveals dated evidence notes when you click a card.
Build a Course Syllabus Roadmap Infographic with Weekly Deadline Badges
A prompt that produces an interactive one-page syllabus roadmap with week cards, quiz, project and exam badges, grade weights and a clickable detail panel.
Build a Classroom Grade Distribution Infographic with Histogram and Quartiles
A single HTML file that turns an inline array of class scores into a histogram with mean and median markers, a box plot, stat cards and a plain-language summary.
Build a Color-Coded Parts of Speech Grammar Cheat Sheet in One HTML File
A prompt that builds an interactive grammar cheat sheet where every word in the example sentences is colored by part of speech, and hovering or tapping a word explains why it fits that category.