🚀 LEVEL UP TO SENIOR:Unlock 500+ Advanced Practical Challenges & Exercises.
🎓 COURSERA PARTNER:Earn professional Google, Meta, and IBM certificates to supercharge your resume.
REFERENCEhtml

html Documentation

LOADING ENGINE...

poster

AI & DATA SCIENCE // poster

The poster attribute on <video> specifies an image to display before playback starts, or while the video is loading.

Syntax

<video controls poster="/thumbnail.jpg">
  <source src="movie.mp4" type="video/mp4">
</video>

Deep Dive Course

**`poster`** gives you control over the very first thing a visitor sees for a `<video>`, instead of the browser's default behavior (often a blank black frame, or an arbitrary early frame of the video, before the user presses play). It's especially useful for setting an intentional, polished thumbnail — like a custom title card — rather than leaving it to chance. Note that `poster` is exclusive to `<video>`; `<audio>` has no visual component and therefore no equivalent attribute.

1Understanding poster

`poster` gives you control over the very first thing a visitor sees for a <video>, instead of the browser's default behavior (often a blank black frame, or an arbitrary early frame of the video, before the user presses play). It's especially useful for setting an intentional, polished thumbnail — like a custom title card — rather than leaving it to chance. Note that poster is exclusive to <video>; <audio> has no visual component and therefore no equivalent attribute.

💡

Without a poster, some browsers show a solid black frame before playback, which can look like a broken video to users — setting an explicit poster avoids that awkward first impression.

editor.html
<video controls poster="/course-intro-thumb.jpg" width="800">
  <source src="/course-intro.mp4" type="video/mp4">
</video>
localhost:3000

2Practical Example

Here is a real-world application of poster showing how it is used in production HTML.

editor.html
<!-- No poster set: browser behavior for the initial frame is inconsistent -->
<video controls>
  <source src="/clip.mp4" type="video/mp4">
</video>
localhost:3000

3Best Practices

Follow these guidelines when working with poster:

1. Always set a poster image for video content to control the pre-play appearance

2. Use an image with the same aspect ratio as the video to avoid letterboxing/cropping surprises

3. Keep the poster's file size reasonably small, since it loads immediately regardless of whether the user ever plays the video

⚠️

Tip: Without a poster, some browsers show a solid black frame before playback, which can look like a broken video to users — setting an explicit poster avoids that awkward first impression.

editor.html
<video controls poster="/course-intro-thumb.jpg" width="800">
  <source src="/course-intro.mp4" type="video/mp4">
</video>
localhost:3000

Examples

Example 01Basic Usage
<video controls poster="/course-intro-thumb.jpg" width="800">
  <source src="/course-intro.mp4" type="video/mp4">
</video>
Example 02Advanced Example
<!-- No poster set: browser behavior for the initial frame is inconsistent -->
<video controls>
  <source src="/clip.mp4" type="video/mp4">
</video>

Best Practices

  • Always set a poster image for video content to control the pre-play appearance
  • Use an image with the same aspect ratio as the video to avoid letterboxing/cropping surprises
  • Keep the poster's file size reasonably small, since it loads immediately regardless of whether the user ever plays the video

Interview Question

Why does poster only apply to <video> and have no equivalent on <audio>?

Hint: Think about what poster is actually controlling.

poster sets the placeholder image shown in the video's visual frame before playback begins — it's specifically about controlling what appears in that rectangular visual area. <audio> has no visual rendering surface at all (it's just a sound-producing element, often just a thin native controls bar), so there's nothing for a 'poster image' to be displayed in, which is why the attribute doesn't exist for it.

Exercises

EasyPractice using poster in a real scenario.
View Solution
<video controls poster="/course-intro-thumb.jpg" width="800">
  <source src="/course-intro.mp4" type="video/mp4">
</video>

Frequently Asked Questions

Why does poster only apply to <video> and have no equivalent on <audio>?

poster sets the placeholder image shown in the video's visual frame before playback begins — it's specifically about controlling what appears in that rectangular visual area.

Related Functions

video-tag