HTML Media

Media is a means of communication.  Media on the web includes images, audio, video, animation, and others. Multimedia is a combination of different media types (content types) on a single page or site.

HTML Tutorial

Example

A <video> media element that plays video files.

<video width="320" height="240" controls>
  <source type="video/mp4" src="/media/movie.mp4">
  <source type="video/ogg" src="/media/movie.ogg">
</video>

For each media type, such as images or video, browsers support a limited number of file formats.

We'll look at the supported file formats for images, audio, and video.

Image Formats

A list of image file formats supported by HTML.

Format File Description
jpeg .jpg,
.jpeg
JPEG was created by the Joint Photographic Experts Group (JPEG). The level of compression in JPEG files can be adjusted, allowing designers to choose between image size and image quality.
png .png Portable Network Graphics (PNG) is a raster graphics format with lossless compression. PNG was created by a group of computer graphics experts in response to a patent dispute over GIF image compression.
webp .webp WebP is a modern image format that provides superior compression. Limited browser support.
svg .svg Simple Vector Graphics (SVG) is the only vector format (versus raster format) supported by HTML. SVG files are much smaller and scale well when reduced or enlarged.
gif .gif Graphics Interchange Format (GIF) was created by CompuServe. GIF is commonly used for small animations and low-resolution video clips. See giphy.com for examples.
bmp .bmp Bitmap graphics format. An older images format that is not used much on the internet.

Audio Formats

A list of audio file formats supported by HTML.

Format File Description
ogg .ogg Ogg is a multimedia container format created by the Xiph.Org Foundation.
wav .wav Created by IBM and Microsoft. Plays well on Windows, Macintosh, and Linux operating systems.
mp3 .mp3 Created by the Moving Pictures Expert Group. MP3 files are actually the sound part of MPEG files. MP3 is the most popular format for music players. Combines good compression (small files) with high quality.
mp4 .mp4 Created by the Moving Pictures Expert Group. MP4 is a video format, but can also be used for audio. MP4 video is becoming the most popular video format on the internet.

Video Formats

A list of video file formats supported by HTML.

Format File Description
ogg .ogg Ogg is a multimedia container format created by the Xiph.Org Foundation.
webm .webm Created by a group of web organizations: Mozilla, Opera, Adobe, and Google.
mp4 .mp4 Created by the Moving Pictures Expert Group. Based on QuickTime. Commonly used in newer video cameras and TV hardware. Recommended by YouTube.

You may also like

Guides