Awesome! The photo makes the webpage much cooler. What’s cooler than a photo? A video!
The HTML video element can add video to a webpage.
<video width="320" height="240" controls> <source src="video-url.mp4" type="video/mp4"> </video>
The video element uses a number of attributes. Let’s take a look at them:
height: Set the size of the screen that displays the video.
controls: Adds play, pause and volume control.
source src: Sets the URL of the video to play.
type: Specifies different video formats.
In index.html, delete the image element so we can use that space on the webpage for a video.
Run your code.
Next, below the paragraph element, create a video element. Use the code above as a guide.
The video will need:
- width and height attributes
- a controls attribute
- a source src set to:
Remember, the attribute values must be in quotes, except for
Run your code to view the video in the web browser.
Click the Play button to play your video. When you’ve watched enough, click Next to continue.