English | 简体中文 | 繁體中文 | Русский язык | Français | Español | Português | Deutsch | 日本語 | 한국어 | Italiano | بالعربية

HTML-Referenzhandbuch

HTML-Tag-Liste

HTML: <source> Tag

Das HTML <source> -Element gibt mehrere Mediendateien für das <picture>, <audio> oder <video> -Element an. Dies ist ein leeres Element. Es wird normalerweise verwendet, um dasselbe Mediengut in verschiedenen von Browsern unterstützten Formaten bereitzustellen.

Online-Beispiel

Ein Video-Player mit drei Quelldateien. Der Browser muss die Quelldatei auswählen, die er unterstützt (wenn alle unterstützt werden, kann eine beliebige gewählt werden):

!doctype html
<html>
<head>
<meta charset="UTF-8">
<title HTML Source-Tag-Benutzung (Grundlagen-Tutorial-Netz)3codebox.com)</title>
</head>
<body>
<video controls>
  <source src="movie.webm" type="video/webm">
  <source src="movie.ogg" type="video/ogg"> 
  <source src="movie.mov" type="video/quicktime">
  I39;m Entschuldigung; Ihr Browser unterstützt nicht39;t support HTML5 video.
</video>
</body>
</html>
Testen Sie, ob ‹/›

Browserkompatibilität

IEFirefoxOperChromeSafari

IE 9+Firefox, Opera, Chrome and Safari all support the <source> tag.

Note:IE 8 or earlier versions of IE browsers do not support the <source> tag.

Tag Definition and Usage

<source> Tag defines and describes media resources for media elements (such as <video> and <audio>).

<source> Tag allows you to specify two videos/Audio files let the browser choose the media type or codec based on its support.

HTML 4.01 and HTML5difference between

<source> Tag is an HTML5 new tag in

Attribute

New: HTML5 new attribute in

AttributeValueDescription
mediaHTML5media_querySpecify the type of the media resource, for the browser to decide whether to download.
srcHTML5URLSpecify the URL of the media file.
typeHTML5MIME_typeSpecify the MIME type of the media resource.

Global Attributes

Support for <source> Tag Global Attributes of HTML.

Event Attributes

Support for <source> Tag HTML Event Attributes.