What does controls mean in html5

青灯夜游
Release: 2022-06-01 19:55:25
Original
7502 people have browsed it

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 "

What does controls mean in html5

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

In HTML5, controls means "control".

What does controls mean in html5

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:

  • Play

  • Pause

  • Positioning

  • Volume

  • Full screen toggle

  • Subtitles (if available)

  • Audio track (if available)

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>
Copy after login

What does controls mean in html5

Example 2:

<audio>
  <source src="horse.ogg"  type="audio/ogg">
  <source src="horse.mp3"  type="audio/mpeg">
您的浏览器不支持 audio 元素。
</audio>
Copy after login

What does controls mean in html5

<audio controls>
  <source src="horse.ogg"  type="audio/ogg">
  <source src="horse.mp3"  type="audio/mpeg">
您的浏览器不支持 audio 元素。
</audio>
Copy after login

What does controls mean in html5

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!

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
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template