【发布时间】:2018-10-19 02:56:09
【问题描述】:
我正在试用带有音频标签的 HTML5。我试图让播放器成为页面的整个宽度。我将正文和整个文档的填充和边距设置为 0px,虽然我可以消除页面顶部的边距,但播放器仍然没有拉伸到页面的整个宽度。我想知道播放器是否有某种最大宽度,因为我没有对整个文档应用边距和填充,但这似乎没有什么区别。谢谢!代码如下:
PS:我暂时忽略了 Firefox,而使用 Chrome
编辑:我通过更改颜色测试了 body 元素的拉伸,它填满了整个页面,所以我觉得必须有某种宽度限制,有什么解决方法吗?
<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">
<title>Zhaden's OST Playlist</title>
<link rel="stylesheet" type="text/css" href="stylesheet.css">
</head>
<body>
<audio id="audioBar" autoplay controls>
<source src="C:\Users\zhaden\Music\iTunes\iTunes Media\Music\Final Fantasy 7 Piano Collection\Final Fantasy VII Piano Collection\05 Fighting.mp3" type="audio/mpeg"> <br>
Your browser does not support the audio element.
</audio>
</body>
</html>
html, body {
overflow-x: hidden; /* This is to ensure we don't allow horizontal scroll */
}
body {
margin: 0px; /* This is to delete the default margin */
}
#audioBar {
width: 100%; /* This is to set the audio bar to the full width of the page */
}
【问题讨论】:
标签: css html html5-audio