HTML <source> src shu xing
ding yi he yong fa
src
suo zhuan xing shi hua yao bo pang de shi pin wén jian de URL。
wan <source> yong yu <audio> en <video> The attribute is required when this is the case.
Example
This is an audio player with two audio source files. The browser should choose the file it supports (if any):
<audio controls> <source src="song.ogg" type="audio/ogg"> <source src="song.mp3" type="audio/mpeg"> Your browser does not support the audio element. </audio>
Syntax
<source src="URL">
Attribute value
Value | Description |
---|---|
URL |
Specifies the URL of the media file. Possible values:
|
Browser support
The numbers in the table indicate the first browser version to fully support this attribute.
Chrome | Edge | Firefox | Safari | Opera |
---|---|---|---|---|
Chrome | Edge | Firefox | Safari | Opera |
4.0 | 9.0 | 3.5 | 4.0 | 10.5 |