Hackforge Academy

Category: html_css

how to load video in html page

Published on 25 May 2026

Explanation

The <video> tag is used to display videos in an HTML page.

Code:

<video></video>

Explanation

The src attribute defines the video file path. The controls attribute shows play, pause, and volume buttons.

Code:

<video src='movie.mp4'></video>

<video src='movie.mp4' controls></video>

Explanation

Width and height attributes set the video size.

Code:

<video src='movie.mp4' controls width='500'
 height='300'></video>

Explanation

The autoplay attribute automatically starts the video.

Code:

<video src='movie.mp4' autoplay controls>
</video>

Explanation

The loop attribute repeats the video continuously.

Code:

<video src='movie.mp4' loop controls>
</video>

Explanation

The muted attribute starts the video without sound. The poster attribute displays an image before the video starts.

Code:

<video src='movie.mp4' muted controls>
</video>

<video src='movie.mp4' 
poster='thumbnail.jpg' controls>
</video>

Explanation

Using the <source> tag allows multiple video formats. You can embed a YouTube video using an iframe.

Code:

<video controls>

<source src='movie.mp4' 
type='video/mp4'>
<source src='movie.webm' 
type='video/webm'>

</video>

<iframe width='560' height='315' 
src='
https://www.youtube.com/embed/T5kjRGmfjsc'>
</iframe>

πŸš€ Learn Spring Boot with real-world projects

πŸ’‘ Build REST APIs step by step

🧠 Improve backend development skills

🎯 Get career-ready practical training

Join Our Free WhatsApp Community

Direct access to niche-specific mentors and peers on WhatsApp.

🐍

Python Community

Discuss Django, FastAPI, AI integration, and automation scripts with 15k+ developers.

Join Python Community
βš›οΈ

React Community

Master Next.js, Framer Motion, and State Management. Share your latest UI components.

Join React Community
β˜•

Java Community

Deep dives into Spring Boot, Microservices architecture, and high-performance backend ops.

Join Java Community