Images

HTML images are defined with the <img> tag.

<img src="images/img1.png" alt="My test image" />

The source file (src), alternative text (alt), width, and height are provided as attributes In the alt attribute, you specify descriptive text for users who cannot see the image.

There are two ways to specify the URL in the src attribute:

1. Absolute URL - Links to an external image that is hosted on another website

2. Relative URL - Links to an image that is hosted within the website. Here, the URL does not include the domain name. If the URL begins without a slash, it will be relative to the current page. It is almost always best to use relative URLs. They will not break if you change domain.

Video

Uses the <video> element.

<video width="320" height="230">
        <source src="media/video1.mp4">
</video>

Other attributes:

  • autoplay
  • muted

Audio

use the <audio> element

Youtube

use the <iframe> element