我如何居中音频播放器?

问题描述 投票:0回答:1

我如何使音频播放器居中?

<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title></title>
    <style>
        #playlist{
            list-style: none;
        }
        #playlist li a{
            color:white;
            text-decoration: none;
        }
        #playlist .current-song a{
            color:blue;
        }
        body {background-color: black;}
        h1 {color: white;}
        p {color: white;}
    </style>
    <link rel="shortcut icon" type="image/ico" href="/img/favicon.ico">
</head>
<body>
    <audio src="" controls autoplay id="audioPlayer">
        Sorry, your Browser doesn't Support HTML5!
    </audio>
    <ul id="playlist">
        <li class="current-song"><a href="/music/song1.mp3"></a></li>
        <li><a href="/music/song2.mp3"></a></li>
    </ul>
    <!-- <p>Back to <a href="https://URL/">URL</a></p> -->
    <script src="https://code.jquery.com/tt.js"></script>
    <script src="audioPlayer.js"></script>
    <script>
        audioPlayer();
    </script>
</body>
</html>

这是我到目前为止的内容:https://prnt.sc/r4o3nh这就是我想要的:https://prnt.sc/r4o3en

我尝试过:style =“ display:block; margin:0 auto;style =“ position:absolute; top:0; left:0; width:100%; height:100%;”宽度=“ 1400”高度=“ 900”

html audio center
1个回答
0
投票

尝试一下:

audio#audioPlayer {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  margin: auto;
}
© www.soinside.com 2019 - 2024. All rights reserved.