ad

Sunday, November 2, 2025

how to use the video tag in html

how to use the video tag in html

https://webdesigningtheory.blogspot.com

video tag 

The HTML 5 <video> tag  use to embedded video on an HTML document. Browsers dont support the same video format so you  provide multiple video formats for correct rendering. A path to the video file is nested inside <source> tag, or src attribute. You can also include an alternate text in the <video>tag, that will be displayed in case if the browser doesn't support the video format.


how to use the video tag in html

Example 

 
<!DOCTYPE html>

<html>

<head>

 <title>Title of the document</title>

 <style>

 video {

width: 300px;

height: 200px;

border: 1px solid #666;

}

</style>

</head>

<body>

<video controls muted >  

<source src="movie.mp4" type="video/mp4">

  <source src="movie.ogg" type="video/ogg">

</video>

 <P>Your browser does not a support in the video tag.</p>

 </body>

 </html >


how to use the video tag in html

Explain Program

Step 1 ]

<!Doctype html>

<!doctype html>  always be the first line of any HTML document.

Step 2 ]

   <html> and </html>

   html  is the root element.

Step 3 ]

<body> and </body>

body  is  main content area.

All visible content inside to  the <body> tag

Step 4]


<head>

 <title>Title of the document</title>

 <style>

 video {

width: 300px;

height: 200px;

border: 1px solid #666;

}

</style>

</head>


<head>contains  metadata  and setting web page


inside the head section 
 
<title>   :-   title of the web page  which appears in the browser tab.
<style>  :-   add  css  (cascading style sheets)  style elements in page.
  
CSS mean :-
          <video> element  300 pixels  wide
          <200> pixel tall
          1-pixel gray border  around (#666 shade  of gray)

Step 5]

<body> section 

  section contains the content that appears  on the web page

<body>

<video controls muted >  

<source src="movie.mp4" type="video/mp4">

  <source src="movie.ogg" type="video/ogg">

</video>

 <P>Your browser does not a support in the video tag.</p>

 </body>



<video controls muted >  

<source src="movie.mp4" type="video/mp4">

  <source src="movie.ogg" type="video/ogg">

</video>

   <video>  tag :- use embed video files directly into web page


         <video> tag is HTML5 element used to embed video file (like .mp4,webm,ogg)
                 into a webpage without need plugin
   Attribute :-
              controls   :-   adds  play,pause volume, and other controls the video player.
              muted      :-   starts the video with sound turned off.
 
  <source>  tag define video file sources 
                        browser support .mp4 
                       

how to use the video tag in html
 output 

Related Post :-

No comments:

Post a Comment