Back to Video Cards
Video Cards

Video Card with Author & Badge

Rich video cards showing category badge, author avatar and view count.

Live preview

Source code

html
<div class="container py-5">
  <div class="row g-4">
    <div class="col-md-6 col-lg-4">
      <div class="card border-0 shadow-sm h-100 overflow-hidden">
        <div class="position-relative">
          <div class="ratio ratio-16x9"><iframe src="https://www.youtube.com/embed/Ke90Tje7VS0" title="React tutorial" allowfullscreen></iframe></div>
          <span class="position-absolute top-0 start-0 m-2 badge bg-primary">React</span>
        </div>
        <div class="card-body">
          <h5 class="card-title mb-2">React JS for Beginners</h5>
          <div class="d-flex align-items-center gap-2">
            <img src="https://i.pravatar.cc/40?img=12" alt="Author avatar for Rahim" class="rounded-circle" width="32" height="32">
            <div class="small">
              <div class="fw-semibold">Rahim Uddin</div>
              <div class="text-muted">128K views · 3 days ago</div>
            </div>
          </div>
        </div>
      </div>
    </div>
    <div class="col-md-6 col-lg-4">
      <div class="card border-0 shadow-sm h-100 overflow-hidden">
        <div class="position-relative">
          <div class="ratio ratio-16x9"><iframe src="https://www.youtube.com/embed/dGcsHMXbSOA" title="Tailwind CSS tutorial" allowfullscreen></iframe></div>
          <span class="position-absolute top-0 start-0 m-2 badge bg-success">Tailwind</span>
        </div>
        <div class="card-body">
          <h5 class="card-title mb-2">Tailwind CSS in 20 Minutes</h5>
          <div class="d-flex align-items-center gap-2">
            <img src="https://i.pravatar.cc/40?img=32" alt="Author avatar for Farhana" class="rounded-circle" width="32" height="32">
            <div class="small">
              <div class="fw-semibold">Farhana Akter</div>
              <div class="text-muted">54K views · 1 week ago</div>
            </div>
          </div>
        </div>
      </div>
    </div>
    <div class="col-md-6 col-lg-4">
      <div class="card border-0 shadow-sm h-100 overflow-hidden">
        <div class="position-relative">
          <div class="ratio ratio-16x9"><iframe src="https://www.youtube.com/embed/rfscVS0vtbw" title="Python tutorial" allowfullscreen></iframe></div>
          <span class="position-absolute top-0 start-0 m-2 badge bg-warning text-dark">Python</span>
        </div>
        <div class="card-body">
          <h5 class="card-title mb-2">Python Complete Beginner Guide</h5>
          <div class="d-flex align-items-center gap-2">
            <img src="https://i.pravatar.cc/40?img=15" alt="Author avatar for Nayeem" class="rounded-circle" width="32" height="32">
            <div class="small">
              <div class="fw-semibold">Nayeem Hasan</div>
              <div class="text-muted">312K views · 2 weeks ago</div>
            </div>
          </div>
        </div>
      </div>
    </div>
  </div>
</div>
<script>
  /*__yt_norm__*/
  (function() {
    function norm(u) {
      try {
        var m = String(u).match(/(?:v=|youtu\.be\/|\/embed\/|\/shorts\/|\/live\/)([\w-]{11})/);
        return m ? ("https://www.youtube.com/embed/" + m[1]) : u;
      } catch (e) {
        return u;
      }
    }
    document.querySelectorAll("iframe").forEach(function(f) {
      var s = f.getAttribute("data-yt") || f.getAttribute("src") || "";
      if (!s) return;
      var n = norm(s);
      if (n && n !== f.src) f.src = n;
    });
  })();

</script>
How to use this video cards

Add it to your project in three steps

  1. Copy the HTML from the Source code tab above and paste it inside your <div class="container"> wrapper.
  2. Make sure the Bootstrap 5 CDN CSS and JS are linked in your <head> and before </body>. Any CodeShikhi component assumes Bootstrap 5.3+ is already loaded.
  3. Swap the placeholder text, links, and images for your own content — the layout, spacing, and responsive behaviour stay intact.

The Video Card with Author & Badge block is fully responsive and works on every screen from 320 px phones to 1440 px+ desktops without additional CSS.

Accessibility checklist

Ship it accessible by default

  • Use semantic HTML landmarks — <header>, <nav>, <main>, <footer> — so screen readers can navigate your page.
  • Give every image an alt attribute (empty alt="" if it's decorative).
  • Label icon-only buttons with aria-label and keep focus outlines visible.
  • Maintain a contrast ratio of at least 4.5:1 for body text against its background.
  • Test the video cards with Tab / Shift+Tab and Enter — every interactive element should be reachable.
Step-by-step customisation

Make it match your brand

  1. Change the colour palette by overriding Bootstrap CSS variables: --bs-primary, --bs-body-bg.
  2. Adjust spacing with utility classes such as py-5, gap-4, and mt-lg-5 — no custom CSS required.
  3. Swap the typography by loading a Google Font in your <head> and setting --bs-body-font-family.
  4. Replace stock images with brand assets. Keep dimensions similar to avoid layout shift.
  5. Preview at multiple breakpoints (mobile, tablet, desktop) and tweak column spans if content wraps awkwardly.

Need the full theory? Read our Bootstrap 5 Technical Introduction Guide for grid, breakpoints, and Sass customisation in depth.

About the Video Card with Author & Badge video cards

This video cards is part of the free CodeShikhi (কোড শিখি) Bootstrap 5 library — a growing collection of copy-paste website building blocks curated for learners and freelance developers. Every block is written in clean, semantic HTML with Bootstrap utility classes, keeps custom CSS to the minimum needed, and works without any build step. Use it as a starting point and adapt the markup, colours, and content to fit your project's brand and audience.

If you spot a bug, want a new variation, or would like to contribute an improvement, reach us via the contact page — we ship updates weekly based on community feedback.

Detailed Technical Breakdown

Detailed Technical Breakdown: Video Card with Author & Badge

Browser compatibility & standards

The Video Card with Author & Badge video cards is authored against Bootstrap 5.3, which drops legacy Internet Explorer support and targets modern evergreen engines — Chrome, Edge, Firefox, Safari, and all Chromium-based mobile browsers. Because the markup relies exclusively on the standard CSS features that ship with Bootstrap (Flexbox, CSS Grid, CSS custom properties, and the responsive breakpoint system), you can safely deploy this video cards to any browser released in the last five years without polyfills. If you need to support very old WebKit or Samsung Internet builds, load the standard Bootstrap 5 CSS from the official jsDelivr CDN — the bundled autoprefixer output already covers those vendor prefixes.

Performance impact

Performance-wise this block is intentionally light. The HTML payload for a typical Bootstrap video cards is under 4 KB gzipped, and it shares the same Bootstrap CSS/JS bundle you are already loading — meaning the marginal cost of adding it to a page is effectively zero KB on repeat visits. There is no JavaScript framework runtime, no hydration cost, and no client-side data fetching. The only images referenced are placeholders you will replace with your own assets; when you do, serve them as WebP or AVIF, add explicit width and height attributes to prevent layout shift (CLS), and lazy-load anything below the fold with loading="lazy". These small changes typically move Lighthouse Performance scores from the mid-80s into the 95+ range on both mobile and desktop.

Utility classes used

The video cards leans on Bootstrap's utility-first classes to stay declarative: spacing utilities (p-*, m-*, gap-*), the flex helpers (d-flex, align-items-*, justify-content-*), the grid system (container, row, col-lg-*), typography helpers (display-*, lead, text-*), and colour utilities that resolve to Bootstrap CSS variables such as --bs-primary, --bs-body-bg, and --bs-border-color. Because everything is expressed as utilities you can re-theme the entire video cards by overriding a handful of CSS variables at the :root level — no Sass recompile required.

Exact customisation steps

  1. Copy the source HTML from the tab above and paste it inside your <body>. The outer <div class="container"> wrapper is already included so the video cards sits on the Bootstrap grid.
  2. Replace the placeholder headings and paragraphs with your own copy. Keep heading levels in order (h1h2h3) so screen readers and search engines can parse the document outline.
  3. Swap any <img> tags for your brand assets. Match the original aspect ratio to avoid layout shift, and always fill in a meaningful alt attribute.
  4. Retune the palette by overriding CSS variables::root { --bs-primary: #4f46e5; --bs-body-bg: #ffffff; }. All utility colour classes update automatically.
  5. Test at each Bootstrap breakpoint — sm (576 px), md (768 px),lg (992 px), xl (1200 px), xxl (1400 px) — using your browser's device toolbar, and tweak column spans if long content wraps.
  6. Ship it with the standard Bootstrap 5 CDN in the <head> and the JS bundle before the closing </body>. No build step required.
Technical & Performance Integration Guide

Technical & Performance Integration Guide — Video Card with Author & Badge (video block)

When and why to use this video block

Embedded video is the single biggest third-party performance cost on most pages. A standard YouTube iframe pulls in roughly 500 KB–1 MB of JavaScript before the visitor has even pressed play, so the way you embed matters more than the player you choose.

Accessibility & ARIA attributes

Give every iframe a meaningful title attribute ("Bootstrap grid tutorial video") — screen readers read it as the frame's accessible name, and an untitled frame is announced only as "frame". Provide captions or a transcript below the player; captions are a WCAG Level A requirement, not an optional extra. Never autoplay with sound, and honour prefers-reduced-motion for any decorative background video.

Performance notes for this pattern

Wrap the iframe in Bootstrap's .ratio.ratio-16x9 so the player reserves its box before the network responds, keeping CLS at zero. Add loading="lazy" to the iframe, and for the best result use the facade pattern: render the poster thumbnail plus a play button, then swap in the real iframe on first click. That single change routinely improves mobile Lighthouse Performance by 20–30 points on video-heavy pages.

Three customisation tricks

  • Use the youtube-nocookie.com host so no tracking cookie is set until the visitor plays the video — helpful for consent compliance.
  • Accept any YouTube URL form (watch?v=, youtu.be/, /embed/, /shorts/) and normalise it to the embed path in one small helper.
  • Add allowfullscreen and the standard allow attribute list so picture-in-picture and fullscreen keep working.

Mistakes to avoid

  • Pasting a watch?v= URL straight into src, which YouTube refuses to frame.
  • Fixed pixel heights that letterbox the player on mobile.

More designs in this section