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” **

![在这里插入图片描述](https://img-blog.csdnimg.cn/3b7e9ca92db0417385f4f083fd991f15.png

Logo

为开发者提供学习成长、分享交流、生态实践、资源工具等服务,帮助开发者快速成长。

更多推荐