CSS Portal

HTML controls Attribute

☕
Enjoying this site?

Help keep it running with a small coffee donation. Every bit of support is appreciated!

Buy us a coffee
controls
HTML AttributeThis attribute is supported by all modern browsers.
Updated 29th March 2024

Description

The HTML controls attribute is a boolean attribute used in the <video> and <audio> elements. When present, it specifies that the default set of playback controls should be displayed on the media element. These controls typically include elements such as play/pause buttons, volume control, and a progress bar, although the exact controls can vary depending on the browser and its version.

The controls attribute does not require a value to be effective. Simply including "controls" within the opening tag of a <video> or <audio> element is enough to enable the display of the browser's default media controls for that element. This allows users to interact with the media, controlling playback without the need for any additional JavaScript or CSS.

Example usage in a <video> element:

<video controls>
  <source src="movie.mp4" type="video/mp4">
  Your browser does not support the video tag.
</video>

And in an <audio> element:

<audio controls>
  <source src="audio.mp3" type="audio/mpeg">
  Your browser does not support the audio element.
</audio>

In both examples, the media elements will be rendered with a set of controls that allow the user to play, pause, and seek through the media, adjust the volume, and possibly access other features such as downloading the media or entering fullscreen mode, depending on the browser's implementation.

Syntax

<tagname controls>

Values

The controls attribute is a boolean attribute, therefore no values are associated with this attribute.

Applies To

Example

<audio controls><source src="audio/chime.mp3" type="audio/mpeg">Sorry your browser does not support the audio tag.</audio>
Open in editor

Browser Support

The following information will show you the current browser support for the HTML controls attribute. Hover over a browser icon to see the version that first introduced support for this HTML attribute.

This attribute is supported by all modern browsers.

Desktop

Chrome
Edge
Firefox
Opera
Safari

Tablets & Mobile

Chrome Android
Firefox Android
Opera Android
Safari iOS
Samsung Internet
Android WebView
-
Supported Unknown Not supported
☕
Enjoying this site?

Help keep it running with a small coffee donation. Every bit of support is appreciated!

Buy us a coffee