Notice: This page requires JavaScript to function properly.
Please enable JavaScript in your browser settings or update your browser.
Audio | Images and Media
HTML Essentials
course content

Contenido del Curso

HTML Essentials

HTML Essentials

1. Understanding the Web and HTML
2. HTML Fundamentals
3. Images and Media
4. Tables and Forms
5. Advanced HTML

bookAudio

In HTML, we can embed audio and video content directly into the web pages using the <audio> and <video> tags, respectively. Let's discuss embedding audio first:

Embedding Audio

The <audio> tag embeds audio content into an HTML document. It allows you to play audio files directly within the browser.

Audio Attributes

  • controls: Adds standard audio controls, such as play, pause, and volume adjustment, to the player;
  • autoplay: Specifies whether the audio should start playing automatically when the page loads;
  • loop: Specifies whether the audio should loop continuously.

Example:

You may have noticed that we have only specified the characteristics of the audio player, but we have not mentioned where the audio is coming from. We need the <source> tag.

Source

The <source> tag is used inside the <audio> tag to specify the URL of the audio file and its attributes. We can use the src attribute to specify the URL of the audio file and the type attribute to specify the MIME type of the audio file.
Example:

In the example above:

  • The <audio> tag includes attributes such as controls, autoplay, and loop;
  • The <source> tags specify the source URLs of the audio files and their MIME types;
  • If the browser does not support the <audio> tag or the specified audio formats, the alternative text Your browser does not support the audio element. is displayed.
html

index

css

index

js

index

copy

Video Tutorial

1. Which tag is used to embed audio content into an HTML document?
2. Why is it recommended to provide the audio in multiple formats?
Which tag is used to embed audio content into an HTML document?

Which tag is used to embed audio content into an HTML document?

Selecciona la respuesta correcta

Why is it recommended to provide the audio in multiple formats?

Why is it recommended to provide the audio in multiple formats?

Selecciona la respuesta correcta

¿Todo estuvo claro?

¿Cómo podemos mejorarlo?

¡Gracias por tus comentarios!

Sección 3. Capítulo 3
some-alt