Add HTML5 video to your site

Want to add video to your site? HTML5 enables us to do this as easily as placing images with an <img> element – and in this tutorial, we’ll show you how the magic is done.

In the example code below, the src attribute points to the video file and controls indicates that we want the browser to show control buttons (play/pause, volume and so on). The value of the optional poster attribute is the path to the static image that the browser will show while the video is loading and before a user hits play. It’s a good idea to pick an appealing frame that will persuade users to view the video. If you don’t use poster, the first frame of the video will be displayed. The code between the opening and closing video tags is fallback content for browsers that have no HTML5 video support.

<video src="m/video.ogv" controls poster="m/video.jpg" width="854" height="480"><p>Your browser can’t play HTML5 video. <a href="m/video.ogv"> Download it</a> instead.</p></video>

Thank you for reading 5 articles this month* Join now for unlimited access

Enjoy your first month for just £1 / $1 / €1

*Read 5 free articles per month without a subscription

Join now for unlimited access

Try first month for just £1 / $1 / €1

The Creative Bloq team is made up of a group of design fans, and has changed and evolved since Creative Bloq began back in 2012. The current website team consists of eight full-time members of staff: Editor Georgia Coggan, Deputy Editor Rosie Hilder, Ecommerce Editor Beren Neale, Senior News Editor Daniel Piper, Editor, Digital Art and 3D Ian Dean, Tech Reviews Editor Erlingur Einarsson and Ecommerce Writer Beth Nicholls and Staff Writer Natalie Fear, as well as a roster of freelancers from around the world. The 3D World and ImagineFX magazine teams also pitch in, ensuring that content from 3D World and ImagineFX is represented on Creative Bloq.