HTML and CSS Reference
In-Depth Information
Start Page with No Sound
<! DOCTYPE HTML >
< html >
< head >
< style type = ”text/css” >
a {
font - family : Verdana , Geneva , sans - serif ;
color : #cc0000;
font - size : 24px ;
text - decoration : none ;
}
</ style >
< meta http - equiv = ”Content-Type” content = ”text/html; charset=UTF-8” >
< title > Transition Sound </ title >
</ head >
< body >
< a href = ”SoundOpen.html” > Click to Next Page </ a >
</ body >
</ html >
Play Sound When Opened
<! DOCTYPE HTML >
< html >
< head >
< style type = ”text/css” >
body {
font - family : Verdana , Geneva , sans - serif ;
color : #cc0000;
font - size : 24px ;
}
</ style >
< meta http - equiv = ”Content-Type” content = ”text/html; charset=UTF-8” >
< title > Sound on Open </ title >
</ head >
< body >
< audio autoplay >
< source src = ”click.wav” >
< source src = ”click.mp3” >
</ audio >
This page clicks .
</ body >
</ html >
210
Save both HTML5 pages in the same folder along with the two sound i les. Test the HTML5
pages with several browsers. When you click the link, it opens a Web page and an <audio>
tag with the autoplay attribute should play the click sound right at er the page loads. If you
have a site where the links go back and forth, the sound plays almost simultaneously with the
Search WWH ::




Custom Search