"."> How to use the source tag of html5-Front-end Q&A-php.cn

How to use the source tag of html5

WBOY
Release: 2022-06-01 17:54:19
Original
2912 people have browsed it

In HTML5, the source tag is used to provide different types of video or audio files for the browser to select. The syntax is "".

How to use the source tag of html5

The operating environment of this tutorial: Windows 10 system, HTML5 version, Dell G3 computer.

The source tag of html5

tag defines media resources for media elements (such as

tag allows you to specify two video/audio files for the browser to choose based on its media type or codec support.

Possible attribute values are as follows:

  • media media_query specifies the type of media resource for the browser to decide whether to download.

  • src URL specifies the URL of the media file.

  • type MIME_type specifies the MIME type of the media resource.

  • sizes Different page layouts set different image sizes.

  • srcset URLis required when applied to the tag. Specify image URLs to use in different situations.

The example is as follows:

Audio player with two source files. The browser needs to select the source file it supports (if both are supported, select any one):

    123 
    
Copy after login

Output result:

How to use the source tag of html5

Recommended tutorial : "html video tutorial"

The above is the detailed content of How to use the source tag of html5. For more information, please follow other related articles on the PHP Chinese website!

Related labels:
source:php.cn
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template
About us Disclaimer Sitemap
php.cn:Public welfare online PHP training,Help PHP learners grow quickly!