我想使html 5音频播放器响应:
<audio controls class="audio-file" src="/path/to/music.mp3">
Sorry your browser belongs to stone age
</audio>
我试过一些
audio {
display: block;
}
但是宽度完全没有变化,并且随着屏幕的缩小,它超出了可见区域。我想知道解决此问题的最佳方法是什么?
通过添加适合对象的CSS属性来尝试此操作
<html>
<head>
<meta name="viewport" content="width=device-width, height=device-height, initial-scale=1.0, minimum-scale=1.0">
<style>
body {
display: block;
margin: 8px;
}
audio{
max-height: 100%;
max-width: 100%;
margin: auto;
object-fit: contain;
}
</style>
</head>
<body>
<audio controls="" autoplay="" name="media">
<source src="path/to/music.mp3" type="audio/mpeg">
</audio>
</body>
</html>
本文收集自互联网,转载请注明来源。
如有侵权,请联系[email protected] 删除。
我来说两句