You are on page 1of 3

Embed Audio and Video in HTML

The HTML <audio> element is used to play an audio file on a web page.

The HTML <audio> Element

To play an audio file in HTML, use the <audio> element:

Example :
<HTML>
<audio controls>
  <source src="horse.ogg" type="audio/ogg">
  <source src="horse.mp3" type="audio/mpeg">
Your browser does not support the audio element.
</audio>
</HTML>

HTML Audio - How It Works

The controls attribute adds audio controls, like play, pause, and volume.

The <source> element allows you to specify alternative audio files which the


browser may choose from. The browser will use the first recognized format.

The text between the <audio> and </audio> tags will only be displayed in


browsers that do not support the <audio> element.

The HTML <video> Element

The HTML <video> element is used to show a video on a web page.

To show a video in HTML, use the <video> element:

Example

<HTML>

<video width="320" height="240" controls>
  <source src="movie.mp4" type="video/mp4">
  <source src="movie.ogg" type="video/ogg">
Your browser does not support the video tag.
</video>
</HTML>

How it Works

The controls attribute adds video controls, like play, pause, and volume.

It is a good idea to always include width and height attributes. If height and


width are not set, the page might flicker while the video loads.

The <source> element allows you to specify alternative video files which the


browser may choose from. The browser will use the first recognized format.

The text between the <video> and </video> tags will only be displayed in


browsers that do not support the <video> element.

HTML <video> Autoplay

To start a video automatically use the autoplay attribute:

HTML
Attributes of Anchor Tag

1. Title : Used to give a title to any hyperlink. It contains some information


about that link, in textual format. The text appears when a user moves his mouse
over that link. This attribute is optional. Note : This attribute can copy the link
text when the full link text is not displayed due to design limitations.
2. ID : This attribute is used to specify a unique ID for the element.
3. The REL and REV attributes of <A> element specify forward and reverse
link types respectively.

Creating an E-Mail link

You can create a link that allows visitors to send an email message quickly.
Mailto : is not actually an HTML tag but a separate program you can use from
within HTML tags. It creates a link that allows the user to write and send an
email to a specified address. You can even specify multiple addresses by
separating each one with a comma and space. The mailto function is supported
by all major browsers.
Syntax :
<A HREF =mailto:india@gmail.com>
india@gmail.com is the email id.
You can write your email id in place of it.
</A>
When you click on the link, the default e-mail program will open and display
the e-mail address in the To field you have mentioned.

You might also like