A podcast episode card built with Tailwind CSS: square cover art on the left, show and episode details on the right, and a compact player with a big play button, seek bar, skip buttons and a speed toggle. Use it on podcast landing pages, episode archives, newsletters with audio, or as a "latest episode" block on a blog.
How it works
The root is article.tpe-card, which stacks on phones and becomes a horizontal flex row from sm up. The cover is a real photo with object-cover, a 16:10 crop on mobile and full card height on larger screens, plus an "EP 48" badge. The details column holds the show name, a save button (data-tpe-save), the episode title, a meta row with a time element, a two-line description clamped with line-clamp-2, and the player area pushed to the bottom with mt-auto.
The script initializes every .tpe-card on DOMContentLoaded. It reads the episode length from data-tpe-duration and the resume point from data-tpe-start (in seconds). Clicking data-tpe-play swaps the play and pause icons, toggles the tpe-is-playing class and starts a simulated clock that advances the data-tpe-seek range input and updates data-tpe-elapsed and data-tpe-remaining. The data-tpe-skip buttons move back 15 or forward 30 seconds, and data-tpe-speed cycles through 1x, 1.25x, 1.5x and 2x, which also speeds up the clock. In style.css, .tpe-eq draws three small bars that bounce only while the card is playing. For real audio, add an audio element and drive the same UI from its timeupdate event.
The cover photo comes from Unsplash; replace it with your own show artwork.
Customization
data-tpe-durationanddata-tpe-starton.tpe-card: set the episode length and where playback resumes; set the rangemaxandvalueto match for the no-JS state.bg-orange-600,accent-orange-600andtext-orange-700: swaporangefortealorvioletto restyle the play button, seek bar and links.SPEEDSat the top ofscript.js: change the playback speed steps, for example[0.75, 1, 1.5, 2].data-tpe-skip="-15"anddata-tpe-skip="30": adjust the jump lengths in seconds.sm:w-64on the cover wrapper: make the artwork column wider or narrower.max-w-3xlon.tpe-card: widen the card for a featured episode.
Use cases
- Podcast websites: an episode card shows cover art, title and details with a play button
- Audio show notes: a seek bar and skip buttons let listeners jump around the episode
- Media apps: a playback speed toggle changes listening speed in one tap
- Blog embeds: a compact player card sits beside an article or newsletter
Accessibility
The card is an article labelled by #tpe-title. The play button's aria-label switches between "Play episode" and "Pause episode", the save button exposes aria-pressed with a hidden "Save episode" label, and the speed button announces its current value. The seek slider has a hidden label and an aria-valuetext such as "14:20 of 42:15". Skip, speed and save changes are announced through the polite data-tpe-status region. All controls have visible focus-visible outlines, and the bouncing bars and hover scale stop under prefers-reduced-motion.