Videos

In previous exercises, we focused on creating more engaging pages using images. Now let's look at another important element, which is video. Unlike images, videos have an opening tag, closing tag, and content.

<video src="video-link" controls>
	Video not supported.
</video>

As we can see, the video element also uses the src attribute, which contains the link to the video, similar to images.

We can also see the controls attribute, which doesn't have a value. This is because it has only two possible values - true or false. So when the video has the controls attribute, it means that we want buttons for controlling the video. When it doesn't have the attribute, it means that we don't want buttons for controlling the video.

The last thing we can notice is the content of the video, Video not supported. This is going to be displayed only if the video fails to load.

Instructions

Above the hypertext link with the content Source, create a video element with the src attribute set to /learn/html/cats-playing.webm.

Add the controls attribute to the video element from the previous instruction to enable video controls.

Add the content Video not supported. to the video element.

Start programming for free

By signing up, you agree to the Terms of Service and Privacy Policy.

Or sign up with:

7/10

Videos | Start Coder