webdevpuneet.com

Bootstrap Video Hero with Play Overlay — Free Snippet

Bootstrap Video Hero with Play Overlay · Heroes · Plain HTML, CSS & JS · Live preview

CategoryHeroes

Copy & paste

Source Code

<section class="bsvhero-section">
  <div class="container py-5 text-center">
    <span class="badge rounded-pill bsvhero-badge mb-3">Product tour</span>
    <h1 class="bsvhero-title">See it in action</h1>
    <p class="bsvhero-sub mb-4">A 90-second walkthrough of the whole workflow, start to finish.</p>

    <div class="bsvhero-frame mx-auto" id="bsvheroFrame">
      <div class="bsvhero-cover" id="bsvheroCover">
        <button class="bsvhero-play" id="bsvheroPlay" aria-label="Play video">
          <svg width="22" height="22" viewBox="0 0 24 24" fill="currentColor"><path d="M8 5v14l11-7z"/></svg>
        </button>
        <span class="bsvhero-duration">1:32</span>
      </div>
      <div class="bsvhero-playing d-none" id="bsvheroPlaying">
        <div class="bsvhero-progress"><div class="bsvhero-progress-bar" id="bsvheroBar"></div></div>
        <span class="small">Playing demo…</span>
        <button class="btn btn-sm btn-light mt-2" id="bsvheroReset">Reset</button>
      </div>
    </div>
  </div>
</section>

Extend with AI

Take This Snippet Further With AI

The AI prompt for this one is for Patreon supporters ($3 a month, 7 days free), along with a site with no ads. Supporters enter the passcode once and it is remembered in this browser.

· Become a supporter

What's included

Features

Real Bootstrap 5.3 layout, badge, and button utility classes
Two-layer cover/playing structure toggled with Bootstrap's d-none utility class
Simulated progress bar shows the interaction shape without requiring a real video file
Reset control returns cleanly to the initial play-button state
Dark gradient hero with a responsive, clamp()-sized headline
Structure maps directly onto a real <video> element or embedded player integration

About this UI Snippet

Bootstrap Video Hero with Play Overlay — HTML, CSS & JavaScript

Screenshot of the Bootstrap Video Hero with Play Overlay snippet rendered live

A product-tour hero usually centers on an embedded video, but a working demo shouldn't require shipping a real video file to be useful as a starting point. This snippet builds the interaction shape on real Bootstrap layout and utility classes: a dark hero, a framed thumbnail with a centered circular play button, and a click handler that swaps the static cover for a "playing" state with an animating progress bar — the exact structure you'd wire a real <video> or embedded player into.

The cover and the playing state are two separate absolutely-positioned layers inside one frame, toggled with Bootstrap's .d-none utility class — swap the progress-bar simulation for a real <video> element's timeupdate event and the rest of the show/hide logic needs no changes.

Step by step

How to Use

  1. 1
    Load the snippetClick the snippet in the sidebar Library tab. The preview loads a dark hero with a video thumbnail and a play button.
  2. 2
    Click the play buttonThe cover swaps out for a "Playing demo…" state with an animating progress bar.
  3. 3
    Let it finish or resetThe bar fills to 100% and stops, or click Reset to return to the play button.
  4. 4
    Swap in a real videoReplace the .bsvhero-cover thumbnail background and playing-state logic with an actual <video> element and its play()/timeupdate events.

Real-world uses

Common Use Cases

Product tour and demo-video landing sections
The standard "watch a 90-second demo" hero pattern, ready to wire to a real video once you have one.
Prototyping before the real video asset exists
Show stakeholders the full interaction — click, play state, progress — before a final video has been recorded or edited.
Learning the cover/playing toggle pattern
A clean, minimal example of swapping two absolutely-positioned states with one utility class.
Landing pages proving a product visually
Pair with the Bootstrap Hero Section snippet's email capture for a two-hero landing page: value prop, then proof.

Got questions?

Frequently Asked Questions

No — it simulates the play interaction with an animating progress bar so the pattern is usable without shipping a real video file. Replace the playing-state markup with a real <video> element or embed to make it functional.

Replace .bsvhero-cover's background with your thumbnail, add a <video> element inside .bsvhero-playing, and call video.play() in the play button's click handler instead of starting the simulated progress interval.

Yes — on click, replace .bsvhero-playing's content with an <iframe> pointing at the embed URL (with autoplay=1) instead of toggling the simulated progress bar.

You would extend it to call video.pause() and reset video.currentTime = 0, or remove the iframe embed, alongside the existing cover/playing class toggle.

It's a real <button> with an aria-label, so it's reachable and understandable via keyboard and screen reader navigation.