HTML and CSS Reference
tually see the audio file in the page, you need to add the controls attribute. Since controls
is a booleanattribute, all you need do is add the attribute word:
<audio src="meadow.ogg" controls>
A booleanattribute is one where a value doesn't need to be assigned to the attribute: its very presence
implies a true value, while the lack of the attribute implies a default false value. However, boolean
attributes must be assigned a value if you're serving your page up as XHTML, or you'll get a page er-
ror. The standard approach for XHTML5 is to assign the attribute a value equal to the attribute name,
contained within quotes and without any extraneous white space ( controls="controls" ).
Figure 1-1 shows the audio element in Firefox after the controls attribute has been added.
The control is rather plain, but it does the job. You now know an audio file has been added to
the page, and you can start and stop the audio file, change the volume, and watch its progress
as it plays.
Figure1-1.Audio element with default control in Firefox 4
Disabled Scripting and the Magically Appearing Controls UI
Both the video and audio elements support the controls attribute for adding a default control
UI (user interface) for the media resource. If you don't want the default control UI, leave