1
我試圖重建這種佈局只有Flexbox的一切中心在一行中將所有內容垂直居中困難。Flexbox的:</p> <p><a href="https://i.stack.imgur.com/cNyfk.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/cNyfk.png" alt="enter image description here"></a></p> <p>我試圖保持儘可能簡單,以最少的標記,但我:在一行
我在做什麼錯?
這是代碼:
body {
margin: 0;
}
#p {
background: #26272b;
color: white;
display: flex;
align-items: center;
padding: 1rem;
justify-content: space-between;
}
img {
width: 1rem;
}
.pp {
width: 2rem
}
<div id="p">
<div id="pl">
<img src="http://mortenhjort.dk/synchub/imgs/beamed-note.svg" alt="note">
<h4>A Head Full Of Dreams <span>- Coldplay</span></h4>
</div>
<div id="pc">
<a href="#">
<img src="http://mortenhjort.dk/synchub/imgs/previous.svg" alt="Click to go back">
</a>
<a href="#">
<img class="pp" src="http://mortenhjort.dk/synchub/imgs/play.svg" alt="Click to play">
</a>
<!-- <a href="#"><img class="pp" src="http://mortenhjort.dk/synchub/imgs/pause.svg" alt="Click to pause"></a> -->
<a href="#">
<img src="http://mortenhjort.dk/synchub/imgs/next.svg" alt="Click to skip">
</a>
</div>
<div id="pr"></div>
<time>00:14/00:30</time>
<div></div>
這是的jsfiddle:https://jsfiddle.net/h1k8v16g/
大評論!謝謝! –