提问人:rap 提问时间:10/16/2023 更新时间:10/16/2023 访问量:64
Spotify 克隆 - 页脚部分 - HTML、CSS
Spotify Clone - Footer Part - HTML, CSS
问:
- 我正在尝试仅使用 HTML 和 CSS 克隆 Spotify,我已经获得了播放器部分,但我无法将播放器居中并获取其他两个详细信息,请查看随附的图像。 名为“目标”的图像是我想要实现的,这里只是我为该部分编写的代码。我还附上了名为“网站”的图片;这就是我的网站现在的样子。
https://imgur.com/PXbmnef - 这是我想要的结果 https://imgur.com/9PDB9Lw - 这就是我的网站现在的样子
<div class="music-player">
<div class="album">
<div class="playing">
<img src="assets/rapgod.jpeg" alt="rapgod" class="cover">
<p class="cover-name">Rap God</p>
<p class="artist">Eminem</p>
</div>
<div class="playing_icons">
<i class="fa-regular fa-heart"></i>
</div>
</div>
<div class="player">
<div class="player-controls">
<img src="/assets/player_icon1.png" alt="" class="player-controls-icon">
<img src="/assets/player_icon2.png" alt="" class="player-controls-icon">
<img src="/assets/player_icon3.png" alt="" class="player-controls-icon" style="opacity: 1; height: 2rem;">
<img src="/assets/player_icon4.png" alt="" class="player-controls-icon">
<img src="/assets/player_icon5.png" alt="" class="player-controls-icon">
</div>
<div class="playback-bar">
<span class="current-time">00:00</span>
<input type="range" min="0" max="100" class="progress-bar" step="1">
<span class="curt-time">3:33</span>
</div>
<div class="controls"></div>
</div>
</div>
这是我的 css 笔记(我已经写了两次音乐,因为当我用它来形成布局时,一个在顶部,一个在底部。我只包含了我面临问题的代码)
.music-player {
background-color: black;
position: fixed;
bottom: 0px;
width: 100%;
height: 72px;
}
.music-player {
display: flex;
justify-content: center;
align-items: center;
}
.album {
width: 25%;
}
.player {
width: 50%;
}
.controls {
width: 25%;
}
.player-controls {
display: flex;
justify-content: center;
align-items: center;
}
.player-controls-icon {
height: 1rem;
margin-right: 1.75rem;
opacity: 0.7;
}
.player-controls-icon:hover{
opacity: 1;
transition: 0.2s;
}
.playback-bar {
display: flex;
justify-content: center;
align-items: center;
}
.progress-bar {
width: 70%;
appearance: none;
background-color: transparent;
cursor: pointer;
}
.progress-bar::-webkit-slider-runnable-track {
background-color: #ddd;
border-radius: 100px;
height: 0.2rem;
}
.progress-bar::-webkit-slider-thumb {
appearance: none;
height: 1rem;
width: 1rem;
background-color: #1bd760;
border-radius: 50%;
margin-top: -6px;
}
.progress-bar::-webkit-slider-runnable-track:hover {
background-color: #1bd760;
transition: 0.2s;
}
.progress-bar::-webkit-slider-thumb:hover {
background-color: #ddd;
transition: 0.2s;
}
我尝试过多种繁荣,但没有一个奏效
答:
0赞
ARJYAN
10/16/2023
#1
试用 display: flex;对齐内容;和 align-iteams;到 div 类 “player”。
0赞
Rao azwar
10/16/2023
#2
您可以使用此 CSS 代码将图标居中。
.player{
margin: auto;
width: 50%;
}
注意:根据您获得的空间调整宽度。
评论