The audio element can embed audio content into an HTML document.
This element is described in the following table.
Element: | audio |
---|---|
Element Type: | Flow/Phrasing |
Permitted Parents: | Any element that can contain flow or phrasing elements |
Local Attributes: | autoplay, preload, controls, loop, muted, src |
Contents: | source and track elements, plus phrasing and flow content |
Tag Style: | Start and end tags |
Style Convention | None |
The following code shows the audio element in use.
<!DOCTYPE HTML> <html> <head> <title>Example</title> </head> <body> <audio controls src="http://java2s.com/style/demo/your.mp3" autoplay> Audio content cannot be played </audio> </body> </html>/*from w w w . ja va 2 s . co m*/
You specify the audio source using the src attribute.