DONATE  
MENU
PHP
JSON
CSS
JAVASCRIPT
HTML
MYSQL
AJAX

HTML Tutorials

INTRODUCTION

» Introduction to HTML

» PRACTICE IT Editor

» Getting Started

» HTML Example

» HTML Tags

» HTML Elements

» Nesting Tags

» Block & Inline Elements

» HTML Attributes

» HTML Comments

» File Paths

» HTML Entities & Symbols

TAGS/ELEMENTS

» Important Tags

» HTML Headings

» Text Formatting

» HTML Links

» HTML Lists

» HTML Tables

» HTML Images

» HTML Audios

» HTML Videos

» HTML Iframes

» HTML Styles

» HTML Scripts

» Semantic Elements

» HTML Metadata

ATTRIBUTES

» Elements' ID

» Elements' Class

» Elements' Style

» Element's Align

» Element's Height & Width

HTML FORMS

» HTML Forms

» Input Elements

» HTML Textarea

» HTML Select

HTML EXAMPLE

» Login Page

.. » HTML » Tags/elements » HTML Audios
Share Tweet WhatsApp

HTML Audios

With HTML5, you no longer need plugins to have and play audio files on your webpage. The <audio> tag is used for creating audio elements. EXAMPLE
<audio controls><source src='my_audio_file_path.mp3' type='audio/mpeg'/>Audio file not supported.</audio>
<audio controls><source src='audio.mp3' type='audio/mpeg'/>Audio file not supported.</audio>

Copy PRACTICE IT

EXPLAINED The <audio> tag defines the audio element. The controls keyword contained in the opening tag helps your audio element have basic options or controls such as play, pause, volume and etcetera, which may vary from browser to browser. Inside the audio element is also the <source> tag which is generally used in defining media files for media elements. There is also a text (Audio file not supported.), which is a text to display when a browser doesn't support the audio element. The source element have an src attribute to specify the path to the audio file and a type attribute to specify the media type of the audio file. You can have as many <source> elements in the <audio> element, which represents different media format of an audio file from which a browser can select from. The browser will usually select the first <source> element with an audio type it supports.
<audio controls>
<source src='myaudio.mp3' type='audio/mpeg'/>
<source src='myaudio.wav' type='audio/wav'/>
Audio file not supported.</audio>
MEDIA TYPES
MEDIA TYPEFORMATS/EXTENSION
audio/mpeg.mp3
audio/wav.wav
audio/ogg.ogg
SUMMARY
  1. The <audio> tag is used in creating audio elements in a webpage.
  2. You can specify the keyword controls to let your audio element have basic controls such as play, pause and etcetera according to each browser.
  3. Inside an audio element is one or more <source> elements and finally a text to display when a browser doesn't support an audio element.
  4. The <source> tag allows us to specify one or more audios in different media format or type so that a browser can choose which to play.
  5. The browser will usually choose the first source element with a media type it supports.
Take a short quiz on HTML Audios.
Ask a question or tell us if HTML Audios is easy or not.
cent?

Join our 1,090 subscribers to receive tutorials' updates!

  We won't spam your mail box. We hate it.





StackBeginner 2021 © Joseph Omamode