audio src Attribute - HTML CSS HTML Tag

HTML CSS examples for HTML Tag:audio

Description

The src attribute specifies the location URL of the audio file.

To make it work in all browsers - use <source> elements inside the <audio> element.

<source> elements can link to different audio files. The browser will use the first recognized format:

Demo Code

ResultView the demo in separate window

<!DOCTYPE html>
<html>
<body>

<audio controls>
  <source src="your.ogg" type="audio/ogg">
  <source src="your.mp3" type="audio/mpeg">
  Your browser does not support the audio element.
</audio><!--from w w  w . ja  va  2 s  .c  om-->

</body>
</html>

Attribute Values

Value Description
URL The URL of the audio file.

Demo Code

ResultView the demo in separate window

<!DOCTYPE html>
<html>
<body>

<audio src="your.ogg" controls>
Your browser does not support the audio element.
</audio><!--from w  ww .  j av a  2 s . c  om-->

</body>
</html>

Related Tutorials