CSS Portal

HTML poster Attribute

☕
Enjoying this site?

Help keep it running with a small coffee donation. Every bit of support is appreciated!

Buy us a coffee
poster
HTML AttributeThis attribute is supported by all modern browsers.
Updated 29th March 2024

Description

The HTML poster attribute is used in conjunction with the <video> element to specify an image that will be shown as a placeholder before the video is played. This image is displayed to the user while the video file is downloading, or until the user hits the play button. The poster attribute helps in providing a visual context or preview of the video content, making it more appealing for users to engage with the video. It's particularly useful for improving user experience by offering a snapshot or a teaser of the video's content.

The value of the poster attribute must be a valid URL, which points to an image file that you want to display as the placeholder. The image format can be any that is supported by the browser, such as JPEG, PNG, or GIF. If the poster attribute is not specified, the browser may show the first frame of the video or a default black screen as the placeholder.

Here's a simple example of how to use the poster attribute in a <video> element:

<video controls poster="path/to/your/image.jpg">
  <source src="path/to/your/video.mp4" type="video/mp4">
  Your browser does not support the video tag.
</video>

In this example, "path/to/your/image.jpg" should be replaced with the actual path to the image you wish to display as a poster, and "path/to/your/video.mp4" with the path to the video file. The controls attribute is also added to allow users to play, pause, and control the video playback.

Syntax

<video poster="URL" />

Values

  • URLURL of the poster image.

Applies To

Example

<video width="400" height="300" controls poster="images/poster.png">
<source src="images/earth.mp4" type="video/mp4">
Your browser does not support the video tag.
</video>
Open in editor

Browser Support

The following information will show you the current browser support for the HTML poster attribute. Hover over a browser icon to see the version that first introduced support for this HTML attribute.

This attribute is supported by all modern browsers.

Desktop

Chrome
Edge
Firefox
Opera
Safari

Tablets & Mobile

Chrome Android
Firefox Android
Opera Android
Safari iOS
Samsung Internet
Android WebView
-
Supported Unknown Not supported
☕
Enjoying this site?

Help keep it running with a small coffee donation. Every bit of support is appreciated!

Buy us a coffee