挑戰:
顯示一系列可以相互重疊的水平卡片,即使
利用Flexbox,我們可以透過將卡片包裝在溢出控制的容器中來創建重疊的卡片:
<code class="css">.cards { display: flex; align-content: center; max-width: 35em; } .cardWrapper { overflow: hidden; } .cardWrapper:last-child, .cardWrapper:hover { overflow: visible; } .card { width: 10em; min-width: 10em; height: 6em; border-radius: 0.5em; border: solid #666 1px; background-color: #ccc; padding: 0.25em; display: flex; flex-direction: column; justify-content: center; align-items: center; }</code>
<code class="html"><div class="cards"> <div class="cardWrapper"> <div class="card">card 1 blah blah blah</div> </div> <div class="cardWrapper"> <div class="card">card 2 blah blah blah</div> </div> <div class="cardWrapper"> <div class="card">card 3 blah blah blah</div> </div> <div class="cardWrapper"> <div class="card">card 4 blah blah blah</div> </div> <div class="cardWrapper"> <div class="card">card 5 blah blah blah</div> </div> </div></code>
以上是如何在水平系列中實現重疊的 Flex 項目?的詳細內容。更多資訊請關注PHP中文網其他相關文章!