HTML中加入背景音乐
HTML中加入背景音乐
·
HTML中加入背景音乐
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<title></title>
<style type="text/css">
#music {
position: absolute;
left: 40%;
top: 45%;
background-color: blue;
}
.audio {
margin: 0.25rem 0;
height: 4rem;
border-radius: 25px;
background: rgb(187, 221, 213);
background: linear-gradient(90deg, rgba(255, 255, 255, 0.82) 0%, rgba(255, 255, 255, 1) 100%);
position: relative;
}
</style>
</head>
<body>
<audio id="music" class="audio" controls autoplay="autoplay" loop="loop" height="100" width="100">
<source src="music/music.mp3" type="audio/mpeg" />
</audio>
</body>
</html>
**修改音乐source src=“music/music.mp3” type=“audio/mpeg” **
