In HTML5, controls means "control" and is an attribute of the audio and video tags. It is used to specify that the browser provides playback controls for video or audio (such as play, pause, positioning, volume, etc.) , syntax "
The operating environment of this tutorial: Windows 7 system, HTML5 version, Dell G3 computer.
In HTML5, controls means "control".
controls is an attribute of the audio and video tags. The
controls attribute specifies that the browser should provide playback controls for video or audio.
If this property is set, it specifies that there is no script control set by the author.
Browser controls should include:
Note:
In XHTML, this attribute is not allowed to be abbreviated, controls attribute Must be defined as <audio controls="controls"></audio>
.
But in HTML5, the attribute value of this attribute can be omitted and can be <audio controls></audio>
directly.
Example 1:
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
</head>
<body>
<video width="320" height="240" controls>
<source src="movie.mp4" type="video/mp4">
<source src="movie.ogg" type="video/ogg">
您的浏览器不支持 video 标签。
</video>
<video width="320" height="240">
<source src="movie.mp4" type="video/mp4">
<source src="movie.ogg" type="video/ogg">
您的浏览器不支持 video 标签。
</video>
</body>
</html>
Example 2:
<audio>
<source src="horse.ogg" type="audio/ogg">
<source src="horse.mp3" type="audio/mpeg">
您的浏览器不支持 audio 元素。
</audio>
<audio controls>
<source src="horse.ogg" type="audio/ogg">
<source src="horse.mp3" type="audio/mpeg">
您的浏览器不支持 audio 元素。
</audio>
It can be seen that if the audio tag does not set the controls attribute, the music player cannot be noticed.
Related recommendations: "html video tutorial"
The above is the detailed content of What does controls mean in html5. For more information, please follow other related articles on the PHP Chinese website!