如何使音频播放器居中

如何使音频播放器居中

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

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

最佳答案

试试这个:

audio#audioPlayer {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  margin: auto;
}

关于html - 如何使音频播放器居中?,我们在Stack Overflow上找到一个类似的问题:https://stackoverflow.com/questions/60303503/

10-13 02:42