<img controls>
- Attribute of
- HTML Tags Guide To Adding Images To Your Web Documents
- What does
<img controls>
do? - Toggled media player controls when used in conjunction with the
dynsrc
attribute. Both attributes are now deprecated.
Before the HTML specification included media elements like <video>
, there was an attempt to add video player controls into the image element. The idea was to specify an additional attribute, dynsrc
(dynamic source) which pointed to a video file.
<img src="flamingo.jpg" dynsrc="flamingo-movie.mpg">
The idea was that if your browser supported the video format, you could watch the video. If it did not support it, you would see the underlying still picture defined in src
. The controls
attribute was intended to toggle the playback controls: if the attribute was included, the user could see the playback controls. If not, the video just played.
<img src="flamingo.jpg" dynsrc="flamingo-movie.mpg" controls>
This never really worked at the time, for a number of reasons (browser technology, internet speed, server expense), and was written out of the specification. Today, if you want to include video, you simply use the <video>
element. Interestingly, the controls
attribute is now a part of the <video>
specification.